Improvements to Rust QOL [wip]#1808
Open
puremourning wants to merge 3 commits intoycm-core:masterfrom
Open
Conversation
Rust analyzer returns the full rendered output of the error from the rust compiler, which is quite useful as a detailed diagnostic. Provide a way for LSP concrete implementations to override the detailed diag, and return it. Do the same for GetDoc. Requires a client to support 'markdown' filetype parameter, but doesn't fundamentally break clients that don't. LSP has "Hint" type diagnostics. YCM sorts diagnostics based on the 'kind'. This worked fine with Warning and Error (where 'E' < 'W'), but unfortunately, 'H' is less then warning meaning that the hints override warnings. This makes some errors look silly. Return the actual severity (integer) as well as the kind, allowing YCM to sort them correctly. Add 2 secret subcommands to rust: - BuildProcMacros; this tells RA to rebuild the compile time macros which can get out of whack occasionally. - ExpandMacro: Useful to view the expanded form of a macro_rules! macro. We just use a text output with no special formatting as that's better than nothing and we don't really have a way to tell YCM to render the output as rust code (though we could add that later)
This adds support for rename/create/delete of files in response to user actions and for "workspace edits" to be sent to the client in cases other than as a result of a YcmCompelter command. The purpose of this is to support some niche language servers that send these edits in response to external triggers (in particular this is used by the Slint language server). But resource operations are independently useful, creation of classes, rename of files in response to refactorings, etc. Requires client support, of course. We model these unsolicited requests as notifications for the client because YCM protocol does not have "server to client" requests like LSP and there's really nothing that a server can do in response to the rejection anyway. When we get such a request, we put it in the notifications queue and "ack" the request.
Rust projects don't just have a single Cargo.toml. They can have a deep folder structure with multiple crates within. Cargo.lock is a better indicator of the root of the project. Bit even then we probably want to find the _furthest_ away Cargo.foo not the nearest, as that's more likely to be the real project root. Implement that somewhat generically so that other completers can use it. Java already has a similar codepath but it's more complicated so not touching it. Finally, even with the above 2 changes, we still have a problem because there might just be gaps. Taking wasmtime project for example there are: ./Cargo.toml ./Cargo.lock ./src/foo.rs ./crates/bar/Cargo.toml ./crates/bar/src/bar.rs ./crates/baz/Cargo.toml ./crates/baz/src/baz.rs So, we allow for the top-level 'project_directory' setting to take precedence _if_ the file opened is in a subdirectory of it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is