Where is `deglob`?
iago-lito opened this issue · comments
coc-rls README claims to support deglob
refactor action.. but I cannot figure out a way to use it :(
For instance, how should I deglob this file?
use std::collections::*;
fn main() {
let mut a = HashMap::new();
let mut b = HashSet::new();
a.insert(5, 8);
b.insert(3);
println!("{:?} {:?}", a, b);
}
I have tried requesting <Plug>(coc-codeaction)
from the first line with no luck, or :call CocAction("doCodeAction", 'deglob')
but nothing changed. A simple search like :help coc-nvim
then /deglob
yielded no result either :(
Is the feature actually supported?
If yes, how do I use it?
https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
I think the rls you're using not support this feature.
Here is the output I have captured with the Wiki technique you suggest:
[Trace - 12:08:45] Sending request 'initialize - (0)'.
Params: {
"processId": 13551,
"rootPath": "/home/iago-lito/tests/rust_test",
"rootUri": "file:///home/iago-lito/tests/rust_test",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional"
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"definition": {
"dynamicRegistration": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"codeAction": {
"dynamicRegistration": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true
},
"documentLink": {
"dynamicRegistration": true
},
"typeDefinition": {
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true
},
"declaration": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
}
}
},
"initializationOptions": {
"omitInitBuild": true,
"cmdRun": true
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/iago-lito/tests/rust_test",
"name": "rust_test"
}
]
}
[Trace - 12:08:45] Received response 'initialize - (0)' in 11ms.
Result: {
"capabilities": {
"textDocumentSync": 2,
"hoverProvider": true,
"completionProvider": {
"resolveProvider": true,
"triggerCharacters": [
".",
":"
]
},
"definitionProvider": true,
"implementationProvider": true,
"referencesProvider": true,
"documentHighlightProvider": true,
"documentSymbolProvider": true,
"workspaceSymbolProvider": true,
"codeActionProvider": true,
"codeLensProvider": {
"resolveProvider": false
},
"documentFormattingProvider": true,
"documentRangeFormattingProvider": false,
"renameProvider": true,
"executeCommandProvider": {
"commands": [
"rls.applySuggestion-13575",
"rls.deglobImports-13575"
]
}
}
}
[Trace - 12:08:45] Sending notification 'initialized'.
Params: {}
[Trace - 12:08:45] Sending notification 'workspace/didChangeConfiguration'.
Params: {
"settings": {
"rust": {
"clear_env_rust_log": true,
"cfg_test": false,
"unstable_features": false,
"wait_to_build": 1500,
"show_warnings": true,
"use_crate_blacklist": true,
"build_on_save": false,
"features": [],
"all_features": false,
"no_default_features": false,
"racer_completion": true,
"clippy_preference": "opt-in",
"all_targets": true,
"show_hover_context": true
}
}
}
[Trace - 12:08:45] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/iago-lito/tests/rust_test/src/main.rs",
"languageId": "rust",
"version": 1,
"text": "use std::collections::*;\n\nfn main() {\n let mut a = HashMap::new();\n let mut b = HashSet::new();\n a.insert(5, 8);\n b.insert(3);\n println!(\"{:?} {:?}\", a, b);\n}\n"
}
}
[Trace - 12:08:45] Received request 'client/registerCapability - (1)'.
Params: {
"registrations": [
{
"id": "rls-watch",
"method": "workspace/didChangeWatchedFiles",
"registerOptions": {
"watchers": [
{
"globPattern": "/home/iago-lito/tests/rust_test/Cargo.lock"
},
{
"globPattern": "/home/iago-lito/tests/rust_test/target",
"kind": 4
},
{
"globPattern": "/home/iago-lito/tests/rust_test/Cargo.toml"
}
]
}
}
]
}
[Trace - 12:08:45] Sending response 'client/registerCapability - (1)'. Processing request took 5ms
No result returned.
[Trace - 12:08:45] Received request 'client/unregisterCapability - (2)'.
Params: {
"unregisterations": [
{
"id": "rls-range-formatting",
"method": "textDocument/rangeFormatting"
}
]
}
[Trace - 12:08:45] Sending response 'client/unregisterCapability - (2)'. Processing request took 1ms
No result returned.
[Trace - 12:08:45] Received notification 'window/progress'.
Params: {
"done": null,
"id": "progress_1",
"message": null,
"percentage": null,
"title": "Building"
}
[Trace - 12:08:45] Received notification 'window/progress'.
Params: {
"done": null,
"id": "progress_1",
"message": "rust_test",
"percentage": null,
"title": "Building"
}
I can read interesting mentions of refactor.inline
or refactor.rewrite
actions, and also something related to rls.deglobImports-13575
, but I am not sure what those mean.
The rls I'm using has been installed with rustup component add rls
if I remember well.
$ rustup component list | grep rls
rls-x86_64-unknown-linux-gnu (installed)
I would be suprised if it did not feature deglob
according to this post. How can I be sure? Which rls should I use then?
Could be wrong action id.
Try :call CocActionAsync('codeAction', '')
in the line you want to run deglob
action, then checkout output channel.
This yields
[Trace - 15:00:16] Sending request 'textDocument/codeAction - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/iago-lito/tests/rust_test/src/main.rs"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 1,
"character": 0
}
},
"context": {
"diagnostics": []
}
}
[Trace - 15:00:16] Received response 'textDocument/codeAction - (1)' in 1ms.
Result: []
.. which looks pretty empty :\
For comparison, I have installed VSCode and deglob is available there. During execution, I can read with htop
that the same binary is being run either when I open vim or when I open VSCode, i.e.
/home/iago-lito/.rustup/toolchains/nightly-2019-04-26-x86_64-unknown-linux-gnu/bin/rls
.
Would it mean that the problem is on vim side?