Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » clangd
Re: clangd [message #57594 is a reply to message #57573] Mon, 04 October 2021 21:58 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Thu, 30 September 2021 02:18
Novo wrote on Sat, 18 September 2021 13:46
mirek 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:
umk uppsrc umk CLANG -j

In case this doesn't work for you I've attached one generated on my machine.


Regards,
Novo
Re: clangd [message #57595 is a reply to message #57594] Mon, 04 October 2021 23:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Mon, 04 October 2021 21:58
mirek wrote on Thu, 30 September 2021 02:18
Novo wrote on Sat, 18 September 2021 13:46
mirek 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:
umk uppsrc umk CLANG -j

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"... Smile

Mirek
Re: clangd [message #57596 is a reply to message #57595] Mon, 04 October 2021 23:39 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Mon, 04 October 2021 17:18
Novo wrote on Mon, 04 October 2021 21:58
mirek wrote on Thu, 30 September 2021 02:18
Novo wrote on Sat, 18 September 2021 13:46
mirek 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:
umk uppsrc umk CLANG -j

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"... Smile

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 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Mon, 04 October 2021 23:39
mirek wrote on Mon, 04 October 2021 17:18
Novo wrote on Mon, 04 October 2021 21:58
mirek wrote on Thu, 30 September 2021 02:18
Novo wrote on Sat, 18 September 2021 13:46
mirek 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:
umk uppsrc umk CLANG -j

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"... Smile

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 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
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 #57600 is a reply to message #57598] Tue, 05 October 2021 09:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Tue, 05 October 2021 06:24
Sorry, 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
Re: clangd [message #57606 is a reply to message #57600] Tue, 05 October 2021 17:21 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Tue, 05 October 2021 03:09
Novo wrote on Tue, 05 October 2021 06:24
Sorry, 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 #57607 is a reply to message #57606] Tue, 05 October 2021 17:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Tue, 05 October 2021 17:21
mirek wrote on Tue, 05 October 2021 03:09
Novo wrote on Tue, 05 October 2021 06:24
Sorry, 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.


Smile it looks like some kind of really weird misunderstanding...
Re: clangd [message #58384 is a reply to message #57574] Mon, 16 May 2022 10:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mirek wrote on Thu, 30 September 2021 12:57
After 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 Smile

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 #59216 is a reply to message #57515] Sun, 27 November 2022 18:48 Go to previous messageGo to next message
shawnx is currently offline  shawnx
Messages: 7
Registered: November 2022
Promising Member
would be great if I can do u++ under vscode somehow, or with vim+clangd, are there some tutorials?

I use bear to generate compile_commands.json then launch vim, seems both clangd and vim are working.

my questions, how can I convert upp to the standard Makefiles? I prefer a standard approach to umks32, do I need convert upp files to Makefile? how should I do that.


Re: clangd [message #59217 is a reply to message #59216] Sun, 27 November 2022 22:30 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
shawnx wrote on Sun, 27 November 2022 12:48
I 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:48
would 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 #59219 is a reply to message #59217] Sun, 27 November 2022 22:43 Go to previous messageGo to next message
shawnx is currently offline  shawnx
Messages: 7
Registered: November 2022
Promising Member
very useful, trying now. I'm excited to learn U++ today.

I have been searching high and low for c++ GUI(Qt, wxwidgets,sciter), somehow U++ was never on the radar, it deserves way more attention. Please brand it as a "BSD version alternative to Qt", it will sell broadly.
Re: clangd [message #59220 is a reply to message #59219] Sun, 27 November 2022 22:59 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
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 #59222 is a reply to message #59216] Mon, 28 November 2022 16:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
shawnx wrote on Sun, 27 November 2022 18:48
would be great if I can do u++ under vscode somehow, or with vim+clangd, are there some tutorials?

I use bear to generate compile_commands.json then launch vim, seems both clangd and vim are working.

my questions, how can I convert upp to the standard Makefiles? I prefer a standard approach to umks32, do I need convert upp files to Makefile? how should I do that.




You can also work from vim with umk directly. Use theide as editor just for layouts / images...

That said, if clangd quality of C++ analysis is what you are missing in theide, we are just closing half-year development cycle that replaces our home-grown parser with libclang.
Re: clangd [message #59223 is a reply to message #59222] Mon, 28 November 2022 16:47 Go to previous messageGo to next message
shawnx is currently offline  shawnx
Messages: 7
Registered: November 2022
Promising Member
That sounds cool, when will it be available?
libclang is not c++20 complete though, for c++17 it shall work really well.

[Updated on: Mon, 28 November 2022 16:48]

Report message to a moderator

Re: clangd [message #59224 is a reply to message #59223] Mon, 28 November 2022 16:54 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello shawnx,

We plan to release next version of TheIDE in near future. I can not exactly tell when it will be, but you can test new assist by downloading nightly builds from this site. Just select the newest possible version of your platform of choice.

It works well with C++17 and C++20 is also supported. You can specify version of the parser in Settings -> Assist menu in "libclang additional compiler options" by adding "-std=x" parameter.

Klugier


U++ - one framework to rule them all.
Re: clangd [message #59226 is a reply to message #59219] Mon, 28 November 2022 17:48 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
shawnx wrote on Sun, 27 November 2022 22:43
Please brand it as a "BSD version alternative to Qt", it will sell broadly.


Except it is not exactly. It is completely different approach to the problem....

Qt is for people that have to do GUI in C++.

U++ is for fools that want to do GUI in C++.
Re: clangd [message #59227 is a reply to message #59223] Mon, 28 November 2022 17:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
shawnx wrote on Mon, 28 November 2022 16:47
That sounds cool, when will it be available?


The plan is to enter "beta" stage at 2022/1/1 and hopefully call it a release by the end of year.

Usually the process is "take nightly build and call it rc[n]". When serious bugs are reported, fix and call it rc[n + 1]. Once nobody complains about it, delete rc bit from the name Smile

Current nightly is good enough for serious development work.

Mirek
Re: clangd [message #59301 is a reply to message #59216] Tue, 13 December 2022 01:26 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
shawnx wrote on Sun, 27 November 2022 12:48
would 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

Previous Topic: about unicode supporting
Next Topic: Compilation on Mac
Goto Forum:
  


Current Time: Thu Mar 28 19:59:42 CET 2024

Total time taken to generate the page: 0.01637 seconds