Coder Social home page Coder Social logo

clangd / vscode-clangd Goto Github PK

View Code? Open in Web Editor NEW
615.0 615.0 101.0 770 KB

Visual Studio Code extension for clangd

Home Page: https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd

License: MIT License

TypeScript 100.00%
clangd vscode

vscode-clangd's Introduction

clangd

clangd is a language server, and provides C++ IDE features to editors. This is not its documentation.

Communication channels

If you have any questions or feedback, you can reach community and developers through one of these channels:

vscode-clangd's People

Contributors

appden avatar bigbahss avatar cloudhan avatar colin-grant-work avatar dependabot[bot] avatar highcommander4 avatar hokein avatar ilya-biryukov avatar jvikstrom avatar kadircet avatar kirillbobyrev avatar krasimirgg avatar markgomez avatar markz3 avatar matms avatar njames93 avatar rapgenic avatar roife avatar sam-mccall avatar sheldonneuberger-sc avatar singha360 avatar sr-tream avatar stefanhaller avatar tamird avatar trass3r avatar trond-snekvik avatar tru avatar trxcllnt avatar vaivaswatha avatar yerseg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-clangd's Issues

GLIBCs not found on host

Hi,

I just installed version 0.1.0 and this is the log output

/home/reiss/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/10rc3/clangd_10rc3/bin/clangd: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/reiss/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/10rc3/clangd_10rc3/bin/clangd)
/home/reiss/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/10rc3/clangd_10rc3/bin/clangd: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/reiss/.vscode-server/data/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/10rc3/clangd_10rc3/bin/clangd)

Would it make sense to do a check on existing GLIBC on the host before installing the new version?

Is there “includePath” option in clangd?

I used to work with vscode C/C++ extension. there was a feature in this extension, called "C_Cpp.default.includePath", which I could set the paths for my headers and get suggestion of my headers and code completion from those. so I want to know is there actually such a feature in clangd? and if YES how can I use that?

File status disappears when changing focus to an output window

See this VSCode issue for more details, the tl;dr is that output windows can show up in vscode.window.activeTextEditor.

As a workaround, you can store the previously open active text editor/document and then ignore changes when an vscode.window.activeTextEditor.document.uri.scheme == 'output' and then check vscode.window. visibleTextEditors to make sure it hasn't disappeared.

Editor reload is required to make changes in compile_command.json take effect for already-open files

When regenerating compile_commands.json, changes don't take effect until editor reload.

Minimal example
create a main.cpp file with the content:

void foo(int a) {}

int main() {
    foo(0);
    return 0;
}

Create a compile_commands.json with the following content (replace directory appropriately):

[
    {
        "arguments": [
            "g++",
            "-c",
            "-Wall",
            "-Wextra",
            "-Werror",
            "-o",
            "main.o",
            "main.cpp"
        ],
        "directory": <path/to/directory>,
        "file": "main.cpp"
    }
]

You should see an error for an unused parameter.
Now remove the warning flags so that compile_commands.json looks like this:

[
    {
        "arguments": [
            "g++",
            "-c",
            "-o",
            "main.o",
            "main.cpp"
        ],
        "directory": <path/to/directory>,
        "file": "main.cpp"
    }
]

The error still appears, although the file compiles.
It disappears only after reloading vscode.

System information
Clangd version (from the log, or clangd --version): 10.0.0-4ubuntu1
clangd extension version: v0.1.6
Operating system: Windows + WSL2 (Ubuntu 20.04)

support commands in settings

For proper CMake support we would need "clangd.arguments": [ "--compile-commands-dir=${command:cmake.launchTargetDirectory}" ].
microsoft/vscode-cmake-tools#654

Problem is that invoking commands is async so you can't just add this in config.ts:

const cmdPrefix = 'command:';
if (name.startsWith(cmdPrefix))
    return await vscode.commands.executeCommand(name.substr(cmdPrefix.length));

Btw, looks like the relevant vscode feature request is microsoft/vscode#46471.

Upload to Open VSX Registry

I think it would be good to automatically publish the extension to the Open VSX Registry also, one reason for which is because VSCodium removed support for the Microsoft extension marketplace.
While one is not prevented from uploading to the registry oneself or to manually install it, it would be much easier this way to stay up to date.

feature request: Parameter Hints shown inline all the time (like IntelliJ)

Hello,

There has been extensive discussion over this issue here: microsoft/vscode#16221

I noticed rust-analyzer provides similar functionality for rust, see https://user-images.githubusercontent.com/2771466/71774757-54269200-2fc8-11ea-8505-ac2f326761ca.png

I wonder whether it is possible to implement support for this in vscode-clangd for C/C++? I noticed that this already happens when you first type a function, but what I am looking for is something that is shown inline all the time.

Better include autocomplete?

Problem

I get autocompletion when I type dot.
In this way, if I want to change the letters, I should delete the dot first, with little inconvenience.

Solution

For example, Include Autocomplete extension works in this way:
When I type "<", it starts detecting input and give autocompletion.

Watch for compile_commands.json

Microsoft CMake extension has this handy ability to automatically copy the compile_commands.json to wherever you want. So it is possible to automatically configure the project and copy the compile_commands.json to workspace location, the only missing part of the puzzle is vscode-clangd should watch for compile_commands.json for change or creation. This feature could be extremely useful.

Support for specifying clangd update channel

Currently you can only automatically install the latest stable version of clangd (10.0.0 at time of writing).
Could an option be added to enable updating to the pre-release versions (I'm guessing from here).
Obviously the option would default to stable release only with users who want the bleeding edge features having the option to get them without having to manually download and setup clangd.
This could also increase coverage for regression testing as more users using the pre-release channel would likely relate to more regressions being reported before it comes time for a major release.

NOLINT/NOLINTNEXTLINE do not work

I have -clang-tidy enabled and it works perfectly, except NOLINT/NOLINTNEXTLINE comments do not make any effect.

VS Code: 1.45.0
clang version 10.0.0

Auto complete starting at incorrect entry

Please see history of closed issue on VSCode: microsoft/vscode#98835

Here's a visual repro of the problem, with debug view enabled:

AutoComplete3

I'm trying to get KeyHeld to select so that I can press tab to auto complete. I have "editor.suggestSelection":"first" setup in my settings.

When I type KeyH it still selects KeyStateHeld. I have to type KeyHeld completely for it to highlight and enable tab completion.

VS Code version: Code 1.45.1 (5763d909d5f12fe19f215cbfdd29a91c0fa9208a, 2020-05-14T08:27:35.169Z)
OS version: Windows_NT x64 10.0.18362
clangd version: 10.0.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz (12 x 3398)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.91GB (18.32GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (5)
Extension Author (truncated) Version
unicode-math-vscode Gui 0.2.6
vscode-clangd llv 0.1.5
cpptools ms- 0.28.1
perforce sle 3.2.0
vscode-jumpy wma 0.3.1

trace setting not supporting ~

Tried "clangd.trace": "~/clangd-trace.json" in combination with the Remote WSL extension.

Logs

Error while opening trace file ~/clangd-trace.json: No such file or directory
clangd version 10.0.0-4ubuntu1 
PID: 10755

System information
Clangd version: 10.0.0-4ubuntu1
clangd extension version: 0.1.6
Operating system: Win10

Go to definition for auto keyword

Go to definition for auto types does not seem to work, even though the type seems to be deducted correctly when hovering the auto keyword, and for suggestions when using . or -> with the type.

struct Foo {
    int a;
};

int main() {
    Foo foo;
    auto &bar = foo;
}

Not possible to go to definition when selecting the auto before bar. Popup label says No definition found for 'auto'.

Expected behavior: Navigational jump to the definition of struct Foo

Attaching simple setup demonstrating issue.
no-go-to-definition-for-auto.zip

System information
Clangd version (from the log, or clangd --version): clangd version 10.0.0
clangd extension version: 0.1.7
Operating system: Ubuntu 19.10

Cannot override "clangd.path" per-workspace any more

With vscode-clangd trunk, "clangd.path" cannot be overridden in Workspace settings any more, only User settings. This was regressed by #56, which made the pref scope=machine.

From the vscode docs, the description of scope=machine is:

machine - Machine specific settings that can be set in user or remote settings. For example, an installation path which shouldn't be shared across machines.

Note, it doesn't mention workspace settings.

I believe being able to override the clangd path per-workspace is useful. For example, I have two local clangd builds, a development build and a stable build, and it's useful to be able to run different ones in different workspaces.

There is a machine-overridable scope which does allow overriding in workspace settings perhaps we can use that instead:

machine-overridable - Machine specific settings that can be overridden by workspace or folder settings.

env var in clangd.path

Is it possible to use an environment variable in the clangd.path setting?
In other vscode settings it is possible to do ${env.VAR}/... but that doesn't seem to work in clangd.path. Is there any alternative? If not, such a feature would be good to have.

Add type hierarchy support to vscode-clangd

Clangd has server-side support for the proposed textDocument/typeHierarchy extension.

It would be nice if vscode-clangd had corresponding client side support.

Eventually this may be implemented in vscode itself (possibly along with a revised API), but to my knowledge that hasn't happened yet.

Allow returning isIncomplete from clangd instead of forcing it to true

Currently the vscode-clangd forces the isIncomplete flag to true, which makes autocompletion in large codebases (e.g. LLVM) fell sluggish. This is especially noticeable when developing on remote server.

Would you be interested in reviewing a PR adding a new setting "serverSideRanking" (set to true by default) which will disable the current isIncomplete override if set to false?

Support for multi-root workspaces

As multi-root workspaces become more popular and widely adopted, it would be great if vscode-clangd could support this as well.

There are many use-cases for C/C++ projects where this would be useful (working with different hardware targets, working across third party libraries, etc.). I imagine there would need to be a fair amount of discussion on how to approach this. Some items for debate are whether the plugin should spawn an instance of clangd per root or whether it should be allowed for the client to specify multiple compilation databases.

Some relevant links to study on the LSP side are the vscode LSP multi-server example which illustrates how to start a server per wokspace folder, and the LSP specification for handling workspace folders. Feel free to discuss below any ideas for how to implement this!

Semantic highlight does not work

My current project uses Windows/cmake/clang-cl/ninja as the main setup. I turned off the official C/C++ extension to isolate the issue. clangd works and does return the correct type and documentation for symbols in the source files. However, semantic highlighting does not seem to work. Below is a screen snippet that shows the correct on-hover doc but no semantic token type

Code_043

Logs

Here's some log for opening a simple file (not the one shown in the screenshot)

vscode-clangd.log

System information
Clangd version: 10.0.0
clangd extension version: 0.1.7
Operating system: Windows 10
VS Code version: 1.49.1

use of scan-build

Hello all,

Can the vscode-clangd use scan-build for static analysis?
if so please do you have some examples or can you point me how to use scan-build with vscode?

Thank you.

Split "clangd.arguments" setting into multiple options

I have to admit that it is a very future-proof design, no matter what argument may be introduced in clangd in the future, we have a way to pass it from clangd extension. However, at the same time this approach isn't the most user friendly, because user has no hints when filling array of options via UI or directly in JSON file.

remote: autoinstall writes `clangd.path` to the local user config, rather than the remote machine config

VSCode Version: Version: 1.46.0-insider (user setup)
Commit: 288852d
Date: 2020-05-12T05:43:31.363Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

OS Version: Windows 10

Steps to Reproduce:

Open VS Code insider
Got notification "The Clangd language server was not found on your PATH. Would you like to download and install clangd 10.0.0". Source: clangd (extension). The only choice is INSTALL button (see screen shot)
Click INSTALL. The installation completed without any issue.
Click Reload Window. VS Code insider restarts, but got the same notification in Step 2. Click INSTALL will go back to step 3.

Meanwhile, clangd extension stopps working. It was fully functional yesterday. Screenshots with REMOTE and WORKSPACE Clangd settings.

VS-clangd-workspace
VS-clangd-remote

Getting a couple of runtime errors

{
	"messages": [],
	"activationTimes": {
		"codeLoadingTime": 53,
		"activateCallTime": 17,
		"activateResolvedTime": 0,
		"activationReason": {
			"startup": false,
			"extensionId": {
				"value": "llvm-vs-code-extensions.vscode-clangd",
				"_lower": "llvm-vs-code-extensions.vscode-clangd"
			},
			"activationEvent": "onLanguage:cpp"
		}
	},
	"runtimeErrors": [
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		},
		{
			"name": "TypeError",
			"message": "Cannot read property 'document' of undefined"
		}
	]
}

In the output panel I'm getting these messages:

[Error - 3:20:37 AM] Request textDocument/documentLink failed.
  Message: Task was cancelled.
  Code: -32001 
[Error - 3:20:37 AM] Request textDocument/codeAction failed.
  Message: Task was cancelled.
  Code: -32001 
[Error - 3:20:37 AM] Request textDocument/documentSymbol failed.
  Message: Task was cancelled.
  Code: -32001 
[Error - 3:20:37 AM] Request textDocument/codeAction failed.
  Message: Task was cancelled.
  Code: -32001 

I don't know the exact steps to reproduce as I'm just opening files and writing code normally in a CMake based project. Here are my settings:

 "clangd.arguments": [
    "--compile-commands-dir=build",
    "--clang-tidy",
    "--completion-style=detailed",
    "--pch-storage=memory",
    "--header-insertion-decorators=false"
  ],

The error messages don't affect me in any way (I just caught them while browsing the console) so it's not a big deal.

Frequent crashing in 0.1.6

Please describe the problem.
After updating to 0.1.6 I get frequent crashes. I am able to restart the extension and it works for a while before stopping again.

Logs

[Error - 11:11:08 AM] Request textDocument/documentLink failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)
[Error - 11:11:08 AM] Request textDocument/codeAction failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)
[Error - 11:11:08 AM] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)
[Error - 11:11:08 AM] Request textDocument/codeAction failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)
[Error - 11:11:08 AM] Request textDocument/documentLink failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)
[Error - 11:11:08 AM] Request textDocument/codeAction failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)
[Error - 11:11:08 AM] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:904:25)
	at Object.dispose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:74:35)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2309:42)
	at ClangdLanguageClient.handleConnectionClosed (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/main.js:155:15)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-languageclient/lib/client.js:2296:18)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at closeHandler (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/main.js:240:26)
	at CallbackList.invoke (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:62:39)
	at Emitter.fire (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/events.js:121:36)
	at StreamMessageWriter.fireClose (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:39:27)
	at Socket.<anonymous> (/home/jack/.vscode/extensions/llvm-vs-code-extensions.vscode-clangd-0.1.6/node_modules/vscode-jsonrpc/lib/messageWriter.js:58:46)
	at Socket.emit (events.js:203:13)
	at Pipe.<anonymous> (net.js:588:12)

System information
Clangd version (from the log, or clangd --version): clangd version 10.0.0 (https://github.com/llvm/llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28)
clangd extension version: 0.1.6
Operating system: Ubuntu 20.04

If clangd crashes on startup, show the reason for the crash (currently only in the Output window) in a dialog

For some reason, clangd crashed a few times and I got the following message: "The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted."

But I can't even restart the server with "Restart server" command in VsCode, the same message will appear. There should be some way to manually restart the server again. Or what else am I suppossed to do?

Download prebuilt binaries

Now we have clangd binary releases for common platforms (https://github.com/clangd/clangd/releases), we could consider auto-installing them so the user doesn't have to do this separately.

I thought this would be as simple as adding os-bound optionalDependencies to the package and then detecting them, but vscode bundles all extensions into the VSIX, which means:

  • the package would be huge and downloaded again for every minor extension revision
  • the OS requirement would be resolved according to the packager's OS, not the user's one

So we probably need to build dynamic downloading instead. RLS does a good job of this, among others.

Plan:

  1. decide where to store downloaded artifacts, how to lay them out etc
  2. add a command to download the latest release from github (or npm?)
  3. add settings to allow easily selecting downloaded vs system vs custom clangd
  4. detect when no clangd is available and prompt the user to download it
  5. detect when there's a new release available and prompt the user to upgrade

Much of this could be shared with coc-clangd, see clangd/coc-clangd#31

Installing clangd on remote host updates the wrong config

When you run the clangd automatic install using remote development, It updates clangd.path in ~/.config/Code/User/settings.json rather than the corresponding settings.json on the remote machine.
<remote>~/.vscode-server/data/Machine/settings.json.
The actual binary is installed in the correct location though.

This leads to the issue on when you leave the remote session and go back to working on local projects, the clangd extension will still look for the clangd binary on the remote server, which will fail, prompting you to reinstall on your local machine. This cycle would then continue next time you load up the remote session.

Support qualified names in workspace/symbol

Currently, a query like Class::Method does not return any results, but it would be useful if it did. The alternatives of searching for Class and then manually navigating to Method within the class, or searching for Method and choosing among potentially many classes that declare a method with that name, are more labour-intensive.

Support relative clangd path

My project (which has 100s of easily confused users) has a configured value for clangd.path. When I start up vscode now it prompts asking if I want to install clangd. It would be great if the extension could skip prompting if the path is valid or provide a config option to disable the prompt.

Syntax coloring doesn't work well with light themes.

Hi there,

I'm on macOS with VSCode 1.45.0 and vscode-clang 0.1.4 (I have disabled the cpptools extension). It seems that vscode-clang changes the syntax highlighting, and it doesn't work well with light theme. Here are some screenshots:

  • Light+ Theme with vscode-clangd disabled
    Screen Shot 2020-05-12 at 5 25 20 PM

  • Light+ Theme with vscode-clangd enabled
    Screen Shot 2020-05-12 at 5 24 43 PM

  • Dark+ Theme with vscode-clangd enabled
    Screen Shot 2020-05-12 at 5 24 53 PM

As you can see, with vscode-clangd enabled, it's very hard to read code under the light theme...

Hover hint comments have no formatting

One would expect Javadoc / doxygen style parameter comments or at least markdown styling to be used in the hover hints.

Currently, there is no formatting, not even linebreaks are respected.

VSCode extension Clangd 0.1.7 stopped working when connecting remotely to host

Setup:

  • VSCode version 1.49.1
  • Clangd extension version: 0.1.7
  • Remote-SSH extension version: 0.55.0

I am using the extension Remote-SSH to edit code on my office workstation (Linux) from my laptop (Windows 10). After updating the VSCode extension to version 0.1.7, whenever I start the editor I get this message:

The 'clangd' language server was not found on your PATH. Would you like to download and install clang 10.0.0?

It seems like the current version of the extension is not picking up the paths on the remote, because downgrading the Clangd version to 0.1.6 works fine.

These are the settings on my machines (both my laptop and office workstation) regarding clangd and terminal:

    "clangd.path": "/compilers/linux-x86_64-2.10.1/clang9.0.0/bin/clangd",
    "clangd.arguments": [
        "--clang-tidy",
        "--compile-commands-dir=lib/linux-x86_64-2.17/clang9.0",
        "--log=verbose"
    ],
    "remote.SSH.suppressWindowsSshWarning": true,
    "terminal.integrated.shell.linux": "/bin/zsh",
    "terminal.integrated.shellArgs.linux": ["-l", "-i"],
    "terminal.integrated.cursorBlinking": true,
    "terminal.integrated.copyOnSelection": true,

On the laptop (Windows) settings the entry "clangd.path" is a darker colour, probably meaning that it isn't used. The paths used there (either relative or absolute) are the ones of the office workstation (Linux).

I have also tried killing/restarting the VSCode server but no luck.

clangd crashing doesn't clear notifications

If clangd crashes while indexing, the indexing notification isn't cleared.
For this type of progress notification its not possible for a user to manually clear it either, leading to a notification tray looking like this:
image
This issue also occurs if you manually restart the clangd server using the command palette

Include path setting

when i open old project, can i set include path for all .cc file to search? i dont want to set one by one like this:
[
{ "directory": "/home/user/llvm/build",
"command": "/usr/bin/clang++ -Irelative -DSOMEDEF="With spaces, quotes and \-es." -c -o file.o file.cc",
"file": "file.cc" },
...
]

Semantic highlight does not work when remote to WSL2

when I use vscode in windows and remote to wsl2, semantic highlight does not work:

BIMDST5~06)8NYM710CMH0H

when I use vscode in wsl2, it works:

9UMM%F}SCO%W$PDVX%X68ZC

Logs

I[22:49:39.409] clangd version 10.0.0
I[22:49:39.409] PID: 1264
I[22:49:39.410] Working directory: /mnt/c/Users/hyuuko/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.2
I[22:49:39.410] argv[0]: /usr/sbin/clangd
I[22:49:39.410] Starting LSP over stdin/stdout
I[22:49:39.412] <-- initialize(0)
I[22:49:39.414] --> reply:initialize(0) 1 ms
I[22:49:39.416] <-- initialized
I[22:49:39.416] unhandled notification initialized
I[22:49:39.417] <-- textDocument/didOpen
I[22:49:39.421] Failed to find compilation database for /mnt/d/a.cc
I[22:49:39.421] --> textDocument/clangd.fileStatus
I[22:49:39.421] Updating file /mnt/d/a.cc with command clangd fallback
[/mnt/d]
/usr/bin/clang /mnt/d/a.cc -fsyntax-only -resource-dir=/usr/lib/clang/10.0.0
I[22:49:39.430] <-- textDocument/documentSymbol(1)
I[22:49:39.432] <-- textDocument/codeAction(2)
I[22:49:39.432] <-- textDocument/documentLink(3)
I[22:49:39.443] --> textDocument/publishDiagnostics
I[22:49:39.443] --> textDocument/semanticHighlighting
I[22:49:39.443] --> reply:textDocument/documentSymbol(1) 12 ms
I[22:49:39.443] --> reply:textDocument/codeAction(2) 11 ms
I[22:49:39.443] --> reply:textDocument/documentLink(3) 11 ms
I[22:49:39.443] --> textDocument/clangd.fileStatus

System information
Clangd version: 10.0.0
clangd extension version: 0.1.6
Operating system: Windows_NT x64 10.0.19041
WSL2: Arch Linux
VScode version: 1.45.1 (system setup)

Member completion with dot-to-arrow fixes have inverted ranking

Reported by @njames93

The items that require fixes are ranked above those that don't...

image
image

As far as I can tell, the cause:

  • the ranking is based on the fuzzy match of the filterText against text in the replaced range of the text edit
  • the server-provided filterText is just the identifier, we patch it up with what we expect to match it against
  • the text in the replaced range is "" for normal completions and e.g. "." for fixits.
  • so we end up matching "" ~ "foo" and "." vs ".foo" - the former is considered a bad match and the latter a good match.
  • same happens with more prefix: "f" ~ "foo" is OK but ".f" ~ ".foo" is better.

It's hard to know how to fix it: the text to be fuzzymatched depends on the actual edit, which we presumably can't change. If we're editing "." then we can either perfectly match it (score higher than anything we can match against "") or not match it (in which case the result gets dropped entirely).

The only thing I can think of is patch up all the items so their actual replacements cover the same amount of text, yuck.

@hokein do you remember if this used to work properly?

do not support windows remote host

I tried to connect to a remote ssh host(windows).
Clangd Path is set to "C:\Program Files\LLVM\bin\clangd.exe" which exists.

Logs
After execute "manually active clangd extension".
It shows "Command 'Manually activate clangd extension' resulted in an error (command 'clangd.activate' not found)".

System information
Clangd version (from the log, or clangd --version): 10.0.0
clangd extension version: 0.1.7
Operating system: Windows 10(remote host windows 10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.