rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Add configuration option for disabling semantic highlighting

Open DavidHancu opened this issue 2 years ago • 12 comments

As the title says, Rust Analyzer should provide a configuration option that allows users to completely disable semantic highlighting. Some extensions may want to override Rust Analyzer's semantic highlighting, but they can't since Rust Analyzer takes precedence.

DavidHancu avatar Nov 09 '23 18:11 DavidHancu

Is this in the context of VSCode? I wonder if you can force VSCode to load/activate extensions in a specific order?

Veykril avatar Nov 10 '23 14:11 Veykril

Yes. I don't believe that you can configure extension priorities.

DavidHancu avatar Nov 15 '23 20:11 DavidHancu

wondering if there is a way to disable semantic highlighting..

DrGo avatar Jun 18 '24 22:06 DrGo

there isn't a configuration option right now, but there can be.

davidbarsky avatar Jun 20 '24 13:06 davidbarsky

Imo this should be something offered by VSCode, disabling it per extension/language, it already has support for limiting configs to that. I don't see why rust-analyzer has to make up for it, the client is already in full control of enabling/disabling this.

Veykril avatar Jun 20 '24 15:06 Veykril

Imo this should be something offered by VSCode, disabling it per extension/language, it already has support for limiting configs to that. I don't see why rust-analyzer has to make up for it, the client is already in full control of enabling/disabling this.

Disabling it per language is not enough, I want semantic highlighting for rust to be provided by another extension other than rust analyzer

DavidHancu avatar Jun 20 '24 16:06 DavidHancu

there isn't a configuration option right now, but there can be.

I think that will be highly appreciated. Do you need a PR?

DrGo avatar Jun 20 '24 17:06 DrGo

Well I stand with that this ought to be a VSCode feature itself, though knowing them that isn't gonna happen anyways so I guess we gotta bite. If we are going to have this as a config this should be a VSCode extension only config though (not a config on the rust-analyzer server itself). The config itself should toggle the corresponding capability here to disable it I think? https://github.com/rust-lang/rust-analyzer/blob/67f7eb505e3aaf37db4bc805c79c95f9be44e2a5/editors/code/src/client.ts#L366-L373

Veykril avatar Jun 20 '24 17:06 Veykril

what is the downside of allowing users of other editors to disable this feature?

DrGo avatar Jun 20 '24 17:06 DrGo

An editor has the option to disable this feature at the LSP level, it makes little sense for the server to have a configuration that changes its own server capability. Especially because that means it would require a restart from the client when changing said capability. In other words, a server configuration is redundant here as the capability system of the LSP already acts a configuration system for LSP features. Additionally, the config does nothing for some clients that don't even support semantic highlighting.

As such, I see this as the responsibility of the client, not the server.

Veykril avatar Jun 20 '24 17:06 Veykril

An editor has the option to disable this feature at the LSP level, it makes little sense for the server to have a configuration that changes its own server capability. Especially because that means it would require a restart from the client when changing said capability. In other words, a server configuration is redundant here as the capability system of the LSP already acts a configuration system for LSP features. Additionally, the config does nothing for some clients that don't even support semantic highlighting.

As such, I see this as the responsibility of the client, not the server.

I am not familiar with the LSP protocol. How can I disable semantic highlighting in neovim?

DrGo avatar Jun 20 '24 18:06 DrGo

I don't know, I don't use neovim. I'd expect the corresponding documentation to describe that

Veykril avatar Jun 21 '24 07:06 Veykril