Home » Developing U++ » U++ Developers corner » clangd
Re: clangd [message #57594 is a reply to message #57573] |
Mon, 04 October 2021 21:58 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Thu, 30 September 2021 02:18Novo wrote on Sat, 18 September 2021 13:46mirek wrote on Fri, 17 September 2021 18:31
Needs BLITZ...
A catch: you have to add all used h-files to compile_commands.json explicitly.
If you send me compile_commands with h-files, I can fix that I think (I mean, add them during compile_commands generation).
Mirek
You can easily generate them by yourself. For example for umk:
In case this doesn't work for you I've attached one generated on my machine.
Regards,
Novo
|
|
|
|
Re: clangd [message #57596 is a reply to message #57595] |
Mon, 04 October 2021 23:39 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Mon, 04 October 2021 17:18Novo wrote on Mon, 04 October 2021 21:58mirek wrote on Thu, 30 September 2021 02:18Novo wrote on Sat, 18 September 2021 13:46mirek wrote on Fri, 17 September 2021 18:31
Needs BLITZ...
A catch: you have to add all used h-files to compile_commands.json explicitly.
If you send me compile_commands with h-files, I can fix that I think (I mean, add them during compile_commands generation).
Mirek
You can easily generate them by yourself. For example for umk:
In case this doesn't work for you I've attached one generated on my machine.
Then I do not understand "have to add explicitely"...
Mirek
When you compile a cpp-project, you compile only cpp/c files. h-files are compiled implicitly via #include directive.
In case of compile_commands.json you need to add them to compile_commands explicitly.
Basically, you need to "compile" h-files as well.
Regards,
Novo
|
|
|
Re: clangd [message #57597 is a reply to message #57596] |
Tue, 05 October 2021 00:18 |
|
mirek
Messages: 14039 Registered: November 2005
|
Ultimate Member |
|
|
Novo wrote on Mon, 04 October 2021 23:39mirek wrote on Mon, 04 October 2021 17:18Novo wrote on Mon, 04 October 2021 21:58mirek wrote on Thu, 30 September 2021 02:18Novo wrote on Sat, 18 September 2021 13:46mirek wrote on Fri, 17 September 2021 18:31
Needs BLITZ...
A catch: you have to add all used h-files to compile_commands.json explicitly.
If you send me compile_commands with h-files, I can fix that I think (I mean, add them during compile_commands generation).
Mirek
You can easily generate them by yourself. For example for umk:
In case this doesn't work for you I've attached one generated on my machine.
Then I do not understand "have to add explicitely"...
Mirek
When you compile a cpp-project, you compile only cpp/c files. h-files are compiled implicitly via #include directive.
In case of compile_commands.json you need to add them to compile_commands explicitly.
Basically, you need to "compile" h-files as well.
So I cannot generate them by umk only, right? I was wondering what you needed to add to make it work...
Mirek
|
|
|
Re: clangd [message #57598 is a reply to message #57597] |
Tue, 05 October 2021 06:24 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
Sorry, I do not get your question.
My version of compile_commands.json works. It is not optimal because it doesn't use BLITZ.
Otherwise it is fine. Everything works.
Regards,
Novo
[Updated on: Thu, 14 October 2021 21:54] Report message to a moderator
|
|
|
|
Re: clangd [message #57606 is a reply to message #57600] |
Tue, 05 October 2021 17:21 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Tue, 05 October 2021 03:09Novo wrote on Tue, 05 October 2021 06:24Sorry, I do not get your question.
Is the file you have sent me exactly the same as produced by umk or did you need to edit it to add header files to it?
Mirek
Attached file is 100% automatically generated. I didn't alter it.
Regards,
Novo
|
|
|
|
Re: clangd [message #58384 is a reply to message #57574] |
Mon, 16 May 2022 10:38 |
|
mirek
Messages: 14039 Registered: November 2005
|
Ultimate Member |
|
|
mirek wrote on Thu, 30 September 2021 12:57After thinking about it for a while, I decided that I am not going to add clangd to TheIDE _myself_:
- it is quite a lot of work
- it does not meet my requirements for speed
- most importantly, I believe that people that want this would actually be even happier with Visual Studio Code (or some other "normal" IDE/editor). To integrate U++ with it seems to be much less work that to add clangd to TheIDE.
- U++ semiheuristic parser is work in progress, but it is MUCH faster than "real compiler" and the current architecture is fine in regards of what it can achieve. I believe that adding missing features to it is in the end less work that to integrate clangd. And much more fun too
That said, if somebody wants to have a try at this, I will be more that happy to watch the progress!
Mirek
OK, I am reconsidering and willing to give clang a try. However, not clangd - clang ast seems pretty reasonable and I think I can do better using blitz and stuff for performance.
That said, if I run clang for anything nontrivial with dump-ast (that dumps ast in human readable form), it takes 20s to generate 400MB file. Meanwhile, emit-ast is fast and creates 40MB of binary file. Has anybody any experience in parsing this binary data or willing to give it a try?
The ideal solution should at max use what is already in win32 release (- I mean, it is ok to use any .dll from clang). I believe libclang-cpp.dll in fact contains whole clang api, so that should be doable.
Mirek
|
|
|
|
Re: clangd [message #59217 is a reply to message #59216] |
Sun, 27 November 2022 22:30 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
shawnx wrote on Sun, 27 November 2022 12:48I use bear to generate compile_commands.json then launch vim, seems both clangd and vim are working.
There is no need to use bear with U++. umk has an option "-j" to do that.
Example: "umk MyApps {dirname} CLANG -j"
shawnx wrote on Sun, 27 November 2022 12:48would be great if I can do u++ under vscode somehow, or with vim+clangd, are there some tutorials?
vim+clangd/ccls.
Redefine "make" as "umk MyApps {dirname} CLANG -bsu", so regular ":make" will use umk.
nnoremap <silent> <F7> :make<CR>
You could take a look at tpope/vim-projectionist which allows moving of all configuration settings out of vimrc and creation of per project configurations.
ccls seems to work better than clangd.
Attached image shows my vim session.
Regards,
Novo
[Updated on: Sun, 27 November 2022 22:32] Report message to a moderator
|
|
|
|
Re: clangd [message #59220 is a reply to message #59219] |
Sun, 27 November 2022 22:59 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
I'm glad you like it.
Below is a list of vim plugins I use with language server.
Pack 'm-pilia/vim-ccls', {'type': 'opt'}
" LSC
Pack 'natebosch/vim-lsc', {'type': 'opt'}
" LSP
Pack 'prabirshrestha/asyncomplete.vim', {'type': 'opt'}
Pack 'prabirshrestha/vim-lsp', {'type': 'opt'}
Pack 'jackguo380/vim-lsp-cxx-highlight', {'type': 'opt'}
I use LSC at this time although I have configuration settings for both of them.
Interesting reading: LSP in Vim with the LSC Plugin
Regards,
Novo
|
|
|
|
|
|
|
|
Re: clangd [message #59301 is a reply to message #59216] |
Tue, 13 December 2022 01:26 |
Novo
Messages: 1371 Registered: December 2006
|
Ultimate Contributor |
|
|
shawnx wrote on Sun, 27 November 2022 12:48would be great if I can do u++ under vscode somehow, or with vim+clangd, are there some tutorials?
I forgot to mention that you need to create a file ~/.vim/compiler/umk.vim which should contain text below.
source $VIMRUNTIME/compiler/gcc.vim
Regards,
Novo
[Updated on: Tue, 13 December 2022 13:17] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Sep 20 16:52:40 CEST 2024
Total time taken to generate the page: 0.04769 seconds
|