Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Support some standard code actions, filter out rust-analyzer custom ones #173

Merged
merged 1 commit into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async function serverEnv(toolchain, cwd) {
env.RUST_BACKTRACE = env.RUST_BACKTRACE || "1"

// if (!env.RUST_LOG && atom.config.get('core.debugLSP')) {
// env.RUST_LOG = 'rls=warn,rls::build=info'
// env.RUST_LOG = 'info'
// }

try {
Expand Down Expand Up @@ -505,9 +505,9 @@ class RustLanguageClient extends AutoLanguageClient {
!filePath.includes('/target/release/')
}

// Killing servers is faster and less likely to get stuck.
// Killing servers is faster and less likely to get stuck, but let's see if rust-analyzer deserves grace...
shutdownServersGracefully() {
return false
return true
}

// Can click through to out-of-project files.
Expand Down Expand Up @@ -576,6 +576,24 @@ class RustLanguageClient extends AutoLanguageClient {
return provide
}

/**
* Hide unsupported rust-analyzer custom actions
* @param {(ls.Command | ls.CodeAction)[]} actions
* @returns {(ls.Command | ls.CodeAction)[]} filtered actions
*/
filterCodeActions(actions) {
return actions.filter(a => !a.command || a.command.command !== "rust-analyzer.applySourceChange")
}

// /**
// * TODO: Handle rust-analyzer custom actions
// * @param {(ls.Command | ls.CodeAction)} action
// * @returns {Promise<boolean>} continue with default handling
// */
// async onApplyCodeActions(action) {
// return true
// }

/**
* Extend base-class to workaround the limited markdown support.
* @param {TextEditor} editor
Expand Down
37 changes: 15 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.