Comments (6)
Wrong type argument: listp, "-Wall -Werror"
Did you specify -Wall -Werror in compile_commands.json
or .ccls
?
This choice, in order to avoid providing any
compile_commands.json
and/or.ccls
files to facilitate debugging.
Neither compile_commands.json
nor .ccls
is mandatory. See https://github.com/MaskRay/ccls/wiki/Project-Setup But ensure (lsp--suggest-project-root)
return the correct project root.
A minimal example is: mkdir /tmp/c; cd /tmp/c; git init; echo 'int a;' > a.cc
Open a.cc
, and execute M-x lsp
from emacs-ccls.
Thank you for your quick answer.
I have created the ccls
file at /tmp/c
that contains the following content:
clang
%c -std=c11
-Wall
-Werror
NOTE: I started from your example and I did not generate the recommanded compile_commands.json
file with CMake
since this folder does not have a CMakeLists.txt
file.
However, after restarting GNU Emacs, opening the /tmp/c/a.cc
file and execute M-x lsp
, but the error is still the same.
As requested, I have checked that the (lsp--suggest-project-root)
function returns the right path. To do this, I changed the mode of the file for lisp-mode
and executed this function that sends me back: "/tmp/c/"
If it can help:
M-x emacs-version
GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05
$ uname -a
Linux ThinkPad 4.20.11-arch1-1-ARCH #1 SMP PREEMPT Wed Feb 20 21:11:12 UTC 2019 x86_64 GNU/Linux
$ ccls --version
ccls version 7.0.1 (tags/RELEASE_701/final)
from emacs-ccls.
-Werror
Unrelated to this issue report, but just wanted to mention that -Werror
is probably not the flag you want to add to .ccls
. If for some reason clang cannot parse your source file (sometimes due to gcc compatibility, sometimes due to clang's own bugs when some clang features like preamble being used), By default, clang stops parsing the file when it encounters 19 errors (cc1 flag: -ferror-limit 19
).
M-x toggle-debug-on-error
and try again.
from emacs-ccls.
This is what M-x toggle-debug-on-error
provides me after opened back the /tmp/c/a.cc
file:
Debugger entered--Lisp error: (wrong-type-argument listp "-Wall -Werror")
make-process(:name "ccls" :connection-type pipe :buffer "*ccls*" :coding no-conversion :command ("/usr/bin/ccls" . "-Wall -Werror") :filter #f(compiled-function (proc output) #<bytecode 0x18031b1>) :sentinel #f(compiled-function (process exit-str) #<bytecode 0x1803c41>) :stderr "*ccls::stderr*" :noquery t)
#f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>)(#f(compiled-function (proc output) #<bytecode 0x18031b1>) #f(compiled-function (process exit-str) #<bytecode 0x1803c41>) "ccls")
lsp--start-workspace(#s(lsp-session :folders ("/tmp/c/" "~/Desktop/test/" "/home/someone/Desktop/test/" "~/.local/share/git/sfml-game/" "/home/someone/.local/share/git/sfml-game/") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x15fdd39> :folder->servers #<hash-table equal 0/65 0x185bd8d> :metadata #<hash-table equal 0/65 0x13fcef9>) #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>) :test\? #f(compiled-function () #<bytecode 0x184893d>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 2/65 0x1848949> :request-handlers #<hash-table equal 0/65 0x18bd1f9> :response-handlers #<hash-table eql 0/65 0x18bd219> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x187b141> :action-handlers #<hash-table equal 0/65 0x187b161> :use-native-json nil :major-modes (c-mode c++-mode cuda-mode objc-mode) :activation-fn nil :priority 0 :server-id ccls :multi-root nil :initialization-options #f(compiled-function () #<bytecode 0x1781705>) :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil) "/tmp/c/" nil)
lsp--start-connection(#s(lsp-session :folders ("/tmp/c/" "~/Desktop/test/" "/home/someone/Desktop/test/" "~/.local/share/git/sfml-game/" "/home/someone/.local/share/git/sfml-game/") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x15fdd39> :folder->servers #<hash-table equal 0/65 0x185bd8d> :metadata #<hash-table equal 0/65 0x13fcef9>) #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>) :test\? #f(compiled-function () #<bytecode 0x184893d>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 2/65 0x1848949> :request-handlers #<hash-table equal 0/65 0x18bd1f9> :response-handlers #<hash-table eql 0/65 0x18bd219> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x187b141> :action-handlers #<hash-table equal 0/65 0x187b161> :use-native-json nil :major-modes (c-mode c++-mode cuda-mode objc-mode) :activation-fn nil :priority 0 :server-id ccls :multi-root nil :initialization-options #f(compiled-function () #<bytecode 0x1781705>) :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil) "/tmp/c/")
#f(compiled-function (client) #<bytecode 0x1b25365>)(#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>) :test\? #f(compiled-function () #<bytecode 0x184893d>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 2/65 0x1848949> :request-handlers #<hash-table equal 0/65 0x18bd1f9> :response-handlers #<hash-table eql 0/65 0x18bd219> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x187b141> :action-handlers #<hash-table equal 0/65 0x187b161> :use-native-json nil :major-modes (c-mode c++-mode cuda-mode objc-mode) :activation-fn nil :priority 0 :server-id ccls :multi-root nil :initialization-options #f(compiled-function () #<bytecode 0x1781705>) :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil))
mapcar(#f(compiled-function (client) #<bytecode 0x1b25365>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>) :test\? #f(compiled-function () #<bytecode 0x184893d>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 2/65 0x1848949> :request-handlers #<hash-table equal 0/65 0x18bd1f9> :response-handlers #<hash-table eql 0/65 0x18bd219> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x187b141> :action-handlers #<hash-table equal 0/65 0x187b161> :use-native-json nil :major-modes (c-mode c++-mode cuda-mode objc-mode) :activation-fn nil :priority 0 :server-id ccls :multi-root nil :initialization-options #f(compiled-function () #<bytecode 0x1781705>) :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil)))
-map(#f(compiled-function (client) #<bytecode 0x1b25365>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>) :test\? #f(compiled-function () #<bytecode 0x184893d>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 2/65 0x1848949> :request-handlers #<hash-table equal 0/65 0x18bd1f9> :response-handlers #<hash-table eql 0/65 0x18bd219> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x187b141> :action-handlers #<hash-table equal 0/65 0x187b161> :use-native-json nil :major-modes (c-mode c++-mode cuda-mode objc-mode) :activation-fn nil :priority 0 :server-id ccls :multi-root nil :initialization-options #f(compiled-function () #<bytecode 0x1781705>) :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil)))
lsp--ensure-lsp-servers(#s(lsp-session :folders ("/tmp/c/" "~/Desktop/test/" "/home/someone/Desktop/test/" "~/.local/share/git/sfml-game/" "/home/someone/.local/share/git/sfml-game/") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x15fdd39> :folder->servers #<hash-table equal 0/65 0x185bd8d> :metadata #<hash-table equal 0/65 0x13fcef9>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1848d59>) :test\? #f(compiled-function () #<bytecode 0x184893d>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 2/65 0x1848949> :request-handlers #<hash-table equal 0/65 0x18bd1f9> :response-handlers #<hash-table eql 0/65 0x18bd219> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x187b141> :action-handlers #<hash-table equal 0/65 0x187b161> :use-native-json nil :major-modes (c-mode c++-mode cuda-mode objc-mode) :activation-fn nil :priority 0 :server-id ccls :multi-root nil :initialization-options #f(compiled-function () #<bytecode 0x1781705>) :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil)) "/tmp/c/" nil)
lsp--try-project-root-workspaces(nil)
lsp()
run-hooks(change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook c++-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook c++-mode-hook))
run-mode-hooks(c++-mode-hook)
c++-mode()
set-auto-mode-0(c++-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer a.cc> "/tmp/c/a.cc" nil nil "/tmp/c/a.cc" (248214 48))
find-file-noselect("/tmp/c/a.cc" nil nil nil)
find-file("/tmp/c/a.cc")
dired-find-file()
funcall-interactively(dired-find-file)
call-interactively(dired-find-file nil nil)
command-execute(dired-find-file)
NOTE: I generally use gcc
to compile my .c
and .cpp
files, so I changed clang
for gcc
in the .ccls
file. However, clang a.cc
works fine in a terminal.
This is the .ccls
file with these modifications:
gcc
%c -std=c11
-Wall
One thing I don't understand is how and why I have to provide the -Wall
and -Werror
flags if I haven't specified to use them everywhere.
In fact, these flags are only defined as compilation options in a CMakeLists.txt
file that I specified in another C++ project (sfml-game
) where I also tried to use lsp-mode
and ccls
. That's why, I tried with a minimal project, in vain.
from emacs-ccls.
ccls-args
is a list of strings. Don't use (setq ccls-args "-Wall -Werror")
from emacs-ccls.
A huge thank you for your patience and help. Indeed, the arguments of ccls-args
was the error. I wonder how it could have been redefined because I don't use it anywhere in my GNU Emacs configuration.
from emacs-ccls.
Related Issues (20)
- c++17, std::optional HOT 1
- Header files not found with emacs-ccls, but works fine at vscode. HOT 1
- imenu: show static member variable instead of function
- Help wanted with configuration: C++ headers not found HOT 1
- conditional highlights doesn't work HOT 2
- Is there a way to manually suspend/resume ccls indexing?
- ccls stuck in "starting"
- Cannot find the references via ccls.xref HOT 2
- Open all hierachy tree at once
- Customize initialization options in S-exp has no effect HOT 1
- Multi-root project setup HOT 2
- Compilation warnings (as of 29.3)
- Using function prototypes auto-completion has strange behavior
- (void-function lsp:ccls-semantic-highlight-symbol-ranges). HOT 11
- use eval-and-compile instead of eval-when-compile HOT 1
- Function definition lsp:ccls-call-children is void HOT 3
- imenu not showing symbol types HOT 3
- Help with .ccls file config: Header file correctly parsed but "file not found" error appears.
- can not jump to std definition
- How to prevent buffers *ccls-tree call/inheritance hierarchy to use same window than buffer Treemacs ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-ccls.