News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Code completion using LSP and clangd

Started by Pecan, February 20, 2021, 09:13:50 PM

Previous topic - Next topic

Pecan

#255
Quote from: gd_on on November 14, 2022, 02:04:13 PM
Cool.
I see that clangd_client plugin is now included in contrib plugins.
Three details :

  • within contrib, it's version 87 though on your svn site it's version 88;
  • CodeBlocks_wx32_64.workspace has not been updated to include the clangd_client but all other workspaces are OK;
  • the documentation-install folder is not there.

gd_on

I don't know how to control that header version number, but the code for rev 88 is included with the contrib commit.

CodeBlocks_wx32_64.workspace corrected; Thanks.

The documentation-install folder was left out on purpose and will be included in the CB wiki for Clangd_client so we can just refer to the wiki url to answer questions. A new section will be added for just "using" the plugin vs "compiling from source.

Thanks

gd_on

#256
OK.
Nevertheless I see at least four differences :
- in version.h, probably not very important (svn version number)
- in manifest.xml, here too not very important (svn version number)
- in codecompletion.cpp, here too not very important (revision number in the headers)
- in LSP_symbolsparser.cpp, small differences near line 2200. I don't know if it's important
There are other differences but only in $HeadURL lines, so no problems.
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Pecan

Quote from: Miguel Gimenez on November 14, 2022, 04:16:26 PM
File clangd_client_wx31.cbp has this linker option:
<Add option="-m64" />
but it is a 32-bit project.
Fixed rev 13031. Thanks

Pecan

Quote from: Miguel Gimenez on November 14, 2022, 02:30:42 PM
Conversely, clangd_client_wx32.cbp is missing although CodeBlocks_wx32.workspace includes it (ticket #1327).
Fixed rev 13031. Thanks

Miguel Gimenez

Thank you for the fix. The new clangd_client_wx32.cbp has some issues:

<Add option="-m64" /> and <Add option="-D_WIN64" /> in compiler options.

References to devel32_64 and .objs32_64

Global variables use #WX32_64

Miguel Gimenez

[r12032] fixed most issues, but this compiler options are still invalid for a 32-bit project.

<Add option="-m64" />
<Add option="-D_WIN64" />


Pecan

Quote from: Miguel Gimenez on November 14, 2022, 07:46:55 PM
[r12032] fixed most issues, but this compiler options are still invalid for a 32-bit project.

<Add option="-m64" />
<Add option="-D_WIN64" />


Thanks, fixed in rev 13033

Miguel Gimenez

*.depend and *.layout files should be added to svn:ignore

The MSW project creates a clangd_client.zip file in the project folder; If this is OK, it should be added also to svn:ignore

The unix_30 project creates .obj30 and devel30 under the project folder, is this OK?.

Pecan

Quote from: Miguel Gimenez on November 15, 2022, 12:09:48 PM
*.depend and *.layout files should be added to svn:ignore

The MSW project creates a clangd_client.zip file in the project folder; If this is OK, it should be added also to svn:ignore

The unix_30 project creates .obj30 and devel30 under the project folder, is this OK?.

Fixed in commit CB rev 13035
.depend was already in the ignore list.
Added .layout to ignore list.
Added clangd_client.zip to the ignore list
Made corrections to clangd_client_wx30.cbp

Thanks

Miguel Gimenez

The .depend is still "active", after compiling the plugin:

c:\Codeblocks>svn status
X       src\plugins\contrib\FortranProject
X       src\plugins\contrib\PythonPlugins
?       src\plugins\contrib\clangd_client\clangd_client_wx32.depend

c:\Codeblocks\src\plugins\contrib\clangd_client>svn proplist -v
Properties on '.':
  svn:ignore
    *.layout
    clangd_client.zip

so *.depends is missing. Other folders (p.e. src/src) add also *_build_log.html, because saving build log to HTML leaves this files around.

IMHO the ignore list should be:

Properties on '.':
  svn:ignore
    *.depend
    *.layout
    *_build_log.html
    clangd_client.zip


Pecan

Quote from: Miguel Gimenez on November 16, 2022, 11:45:10 AM
The .depend is still "active", after compiling the plugin:

c:\Codeblocks>svn status
X       src\plugins\contrib\FortranProject
X       src\plugins\contrib\PythonPlugins
?       src\plugins\contrib\clangd_client\clangd_client_wx32.depend

c:\Codeblocks\src\plugins\contrib\clangd_client>svn proplist -v
Properties on '.':
  svn:ignore
    *.layout
    clangd_client.zip

so *.depends is missing. Other folders (p.e. src/src) add also *_build_log.html, because saving build log to HTML leaves this files around.

IMHO the ignore list should be:

Properties on '.':
  svn:ignore
    *.depend
    *.layout
    *_build_log.html
    clangd_client.zip


Please go ahead and change them as you see fit.
I've read "svn propset -h" three times now, and I still can't figure out how to set ignores.

Miguel Gimenez

QuotePlease go ahead and change them as you see fit.
Done. Just go to the plugin directory and write:
svn propedit svn:ignore .

Pecan

#267
Quote from: Miguel Gimenez on November 17, 2022, 07:46:57 AM
QuotePlease go ahead and change them as you see fit.
Done. Just go to the plugin directory and write:
svn propedit svn:ignore .

The result of this is:

F:\usr\Proj\cbHead\trunk\src\plugins>svn propedit svn:ignore .
svn: E205007: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

It wants me to set some editor like:
set SVN_EDITOR=notepad.exe

Then, running the svn command brings up notepad with the svn:ignore file settings.

I suppose I'm suppose to save it. But who knows....

[rant]Some day I hope to trash svn. It trades intuitiveness for utter confusion plus hours and hours to try and understand it.
[/rant]

ollydbg

Quote from: Pecan on November 09, 2022, 06:36:27 PM
....

The code is trying to parse out the ancestor of a class to add to the symbols tree. Clangd has no protocol msg to achieve that, so I was trying to use the old CodeCompletion code to parse it from the source line.

Do you have any steps you can give me to re-create the situation.

Thanks


/// comment

class A
{
    int m_X;
    int m_Y;
};


To reproduce this issue, you can

first put the caret after the line "/// comment", and just continuously hit the Enter key several times.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

sodev

@Pecan

You are using Windows, you simply don't use cli tools on Windows :P. Install https://tortoisesvn.net/ for your SVN needs.