我在为C++ 11配置flycheck时遇到了很大的麻烦.现在,flycheck正在抨击像std::to_string().我使用的检查器只是g ++.我可以在.emacs文件中添加什么,以便flycheck默认采用C++ 11?
我现在正在使用emacs前奏,并发现一切都很好.但
编辑el文件时会显示很多flycheck警告
和语法着色被覆盖
警告如"第一行应该是表格包---摘要"
如何关闭这些警告?
我试图将包含路径添加到flycheckc/c ++ - clang,但它没有用.
我foo.h输入~/local/include并添加以下行init.el:
(add-hook 'c++-mode-hook
(lambda () (setq flycheck-clang-standard-library "libc++")))
(add-hook 'c++-mode-hook
(lambda () (setq flycheck-clang-language-standard "c++1y")))
(add-hook 'c++-mode-hook
(lambda () (setq flycheck-clang-include-path
(list "$HOME/local/include/"))))
Run Code Online (Sandbox Code Playgroud)
并在一个名为test.cpp我写的文件中
#include <foo.h>
Run Code Online (Sandbox Code Playgroud)
flycheck 说
找不到'foo.h'文件
我究竟做错了什么?我正在使用emacs24,flycheck.el从package.el和clang3.4.
当我编写Haskell代码时,我在emacs中使用flycheck和haskell-hlint,我认为如果我可以通过调用一些emacs程序而不是手动修改代码来应用这些hlint建议会很棒.
如果没有可用的,以防我必须为自己编写此程序:
是否保证hlint输出始终为以下形式:
Found:
{Text1}
Why not:
{Text2}
Run Code Online (Sandbox Code Playgroud)
哪里{Text?}可以始终解析为Haskell抽象语法树?
这里有新的emacs/python用户.
我正努力开始flycheck工作(和使用flake8).
这是我的相关部分init.el:
(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
(add-hook 'python-mode-hook 'flycheck-mode)
Run Code Online (Sandbox Code Playgroud)
当我打开python文件时,我的模式行包括Py FlyC-
From the Flycheck手册,我了解到这意味着Flycheck无法自动找到合适的检查器.
当我运行M-x flycheck-select-checker并选择python-flake8它返回:
Configured syntax checker python-flake8 cannot be used
Run Code Online (Sandbox Code Playgroud)
我正在使用OSX 10.9 homebrew和这些版本:
$ emacs --version
GNU Emacs 24.3.50.1
$ flake8 --version
2.1.0 (pep8: 1.4.6, pyflakes: 0.7.3, mccabe: 0.2.1) CPython 2.7.5 on Darwin
$ which flake8
/usr/local/bin/flake8
$ python --version
Python 2.7.5
$ which python
/usr/local/bin/python …Run Code Online (Sandbox Code Playgroud) 我在同一个目录下2个文件,说a.el和a-test.el.
a.el
;; some functions
(provide 'a)
Run Code Online (Sandbox Code Playgroud)
A-test.el
(require 'a)
Run Code Online (Sandbox Code Playgroud)
flycheck把警告的require在a-test.el说
无法打开加载文件:a
如何让flycheck在同一目录中找到所需的文件?
我在我的 C++ 项目中使用Clang作为语法检查器。它是通过 Emacs 中的 Flycheck 调用的,我收到了一个恼人的 use of undeclared identifier错误,下面的最小工作示例说明了该问题:
在文件中testnamepace.cpp:
#include "testnamespace.hpp"
int main() {
const unsigned DIM = 3;
testnamespace::A<DIM> a;
a.f();
a.g();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在文件中testnamespace.hpp:
#ifndef testnamespace_h
#define testnamespace_h
#include <iostream>
namespace testnamespace {
// My code uses lots of templates so this MWE uses a class template
template <unsigned DIM> class A;
}
template <unsigned DIM>
class testnamespace::A{
public:
static const unsigned dim = DIM;
A() {std::cout …Run Code Online (Sandbox Code Playgroud) 通常,在emacs上编辑JavaScript时,我使用flycheck和jshint来检查语法错误.所以我全局安装了jshint,并在.emacs文件中使用以下命令在js-mode中使用flycheck:
(require 'flycheck)
(add-hook 'js-mode-hook
(lambda () (flycheck-mode t)))
Run Code Online (Sandbox Code Playgroud)
但我也参与了一个项目,他们使用eslint来定义语法规则.我.dir-locals.el在该项目文件夹中有一个文件,目前只定义了所需的列表:
((nil . ((tab-width . 4)
(js-indent-level . 4)))
(js-mode . ((tab-width . 4)
(js-indent-level . 4)))
(html-mode . ((tab-width . 4)
(sgml-basic-offset . 4))))
Run Code Online (Sandbox Code Playgroud)
是否有可能在.dir-locals.el文件的帮助下告诉emacs在此特定项目文件夹中使用带有eslint的flycheck,同时在其余项目中继续使用带有jshint的flycheck?我听说以下几行应该是从jshint切换到eslint的技巧,但我不完全确定在哪里添加它们:
(setq flycheck-disabled-checkers '(javascript-jshint))
(setq flycheck-checkers '(javascript-eslint))
Run Code Online (Sandbox Code Playgroud)
(你可以猜到,我对设置emacs并不是很好,所以我会非常感谢你的具体说明.)
我很高兴通过jedi配置emacs并使用自动完成功能,并通过flycheck和booturap中创建的virtualenvs进行语法检查.这一切似乎都有效.
我想添加使用flycheck-pylint的功能(导入时出错),但我无法使其正常工作.即使我手动更改了virtualenv(Mx:pyvenv-activate RET path-to-my-venv),我仍然会看到很多导入错误来自于使用的错误virtualenv.
我目前的初始化代码:
(require 'pyvenv)
(add-hook 'after-init-hook #'global-flycheck-mode)
(defun set-flake8-executable ()
(pyvenv-activate (get-current-buffer-venv))
(flycheck-set-checker-executable (quote python-flake8)
(get-current-buffer-flake8)))
Run Code Online (Sandbox Code Playgroud)
其中"get-current-buffer-venv"和"get-current-buffer-flake8"是实现我特定设置并正常工作的函数.
如何更改使用的解释器?
Archlinux 用户使用 Emacs 作为 C++ IDE,设置如下:company/flycheck/lsp-ui/ccls
我正在尝试将filesystemc++17 中的库用于个人用途,但我无法摆脱 Emacs 中的此错误
ccls : no member named 'filesystem' in namespace 'std'
我的问题的快速示例
#include <iostream>
#include <filesystem>
int main(int argc, char** argv) {
std::filesystem::path filePath("./sample.cpp");
std::cout << filePath.filename() < std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用此命令编译和运行时完全没问题:
clang++ -std=c++17 sample.cpp
输出 : "sample.cpp"
但是 Emacs 中仍然存在“错误”,这有点烦人。我尝试添加.ccls具有以下内容的文件,但这并不能解决问题。
clang++
%cpp -std=c++17 ; Also tried with gnu++17
Run Code Online (Sandbox Code Playgroud)
这是问题的屏幕截图。错误cout和filePath是第一个的后果我猜是因为总的来说一切都很好
有人知道如何解决问题吗?