rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.28k stars 1.61k forks source link

Add configuration option for disabling semantic highlighting #15861

Open DavidHancu opened 1 year ago

DavidHancu commented 1 year ago

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.

Veykril commented 1 year ago

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

DavidHancu commented 12 months ago

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

DrGo commented 4 months ago

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

davidbarsky commented 4 months ago

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

Veykril commented 4 months ago

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.

DavidHancu commented 4 months ago

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

DrGo commented 4 months ago

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

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

Veykril commented 4 months ago

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

DrGo commented 4 months ago

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

Veykril commented 4 months ago

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.

DrGo commented 4 months ago

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?

Veykril commented 4 months ago

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