sublimelsp / LSP-clangd

C/C++ support for Sublime's LSP plugin provided through clangd.
MIT License
42 stars 1 forks source link

Allow changing the command used to start clangd #11

Closed LDAP closed 1 year ago

LDAP commented 1 year ago

Closes #10

@takase1121 This PR introduces a new option for "binary": "custom". Then the command can be set as:

"initializationOptions": {
        "custom_command": ["C:/msys64/msys2_shell.cmd", "-defterm", "-here", "-no-start", "-mingw64", "-c", "clangd"],
}

Please report back if that fixes the issue for you.

@kutu initializationOptions can be overwritten per project. @berteauxjb The system binary can now be set as: "system_binary": "clangd-12"

takase1121 commented 1 year ago

How can I try it out?

LDAP commented 1 year ago

Just clone this repo into the Packages folder

berteauxjb commented 1 year ago

Hey @LDAP, thanks so much for looking into it! I can confirm that I can properly configure the system binary to use clangd-12. However I still have another issue that might be relevant to this PR.

My compile_commands.json file is not at the root of the project, so I have to pass --compile-commands-dir arg to clangd-12. Since this path changes for each project, I have to have this setting in the .sublime-project file. I saw you mentioned initializationOptions can now be overwritten per project, so I tried multiple things without success:

It seems like the plugin doesn't read any settings from the project file for initializationOptions. The JSON auto-completion also doesn't bring any options for any of the keys in initializationOptions (but works when used in the LSP-clangd setting file).

takase1121 commented 1 year ago

Just clone this repo into the Packages folder

It seems to work.