Closed leafpaulc closed 4 years ago
Works for me. Please post your Packages/User/LSP.sublime-settings file.
Can you paste your rust analyzer client configuration from LSP.sublime-settings here.
Also in LSP.sublime-settings, you can enable debugging:
"log_debug": true,
"log_server": [
"panel",
],
Close sublime,
LSP: enabled configs: LSP-css, LSP-dockerfile, LSP-elm, LSP-eslint, LSP-intelephense, LSP-json, LSP-pyright, LSP-typescript, LSP-vue, clangd, gopls, lsp-lemminx, rust-analyzer
LSP: toggle log panel
,
copy paste the output from that LSP log panel here.from LSP: toggle log panel, as I type "p" (no pop up shows)
:: -> rust-analyzer textDocument/didChange: {'contentChanges': [{'range': {'start': {'line': 44, 'character': 0}, 'end': {'line': 44, 'character': 0}}, 'rangeLength': 0, 'text': 'p'}], 'textDocument': {'version': 30, 'uri': 'file:///home/paul/aa/workspaces/rust_workspace/gigasecond/src/lib.rs'}}
:: --> rust-analyzer textDocument/completion(42): {'textDocument': {'uri': 'file:///home/paul/aa/workspaces/rust_workspace/gigasecond/src/lib.rs'}, 'position': {'line': 44, 'character': 1}}
:: <- rust-analyzer textDocument/publishDiagnostics: {'version': 30, 'diagnostics': [{'range': {'start': {'line': 44, 'character': 1}, 'end': {'line': 44, 'character': 1}}, 'source': 'rust-analyzer', 'message': 'Syntax Error: expected SEMICOLON', 'severity': 1}, {'range': {'start': {'line': 39, 'character': 12}, 'end': {'line': 39, 'character': 13}}, 'code': 'unused_variables', 'source': 'rustc', 'message': 'unused variable: s
\n#[warn(unused_variables)]
on by default', 'severity': 2, 'tags': [1]}], 'uri': 'file:///home/paul/aa/workspaces/rust_workspace/gigasecond/src/lib.rs'}
:: --> rust-analyzer textDocument/codeAction(43): {'range': {'start': {'line': 44, 'character': 1}, 'end': {'line': 44, 'character': 1}}, 'context': {'diagnostics': [{'range': {'start': {'line': 44, 'character': 1}, 'end': {'line': 44, 'character': 1}}, 'source': 'rust-analyzer', 'message': 'Syntax Error: expected SEMICOLON', 'severity': 1}]}, 'textDocument': {'uri': 'file:///home/paul/aa/workspaces/rust_workspace/gigasecond/src/lib.rs'}}
:: <<< rust-analyzer 42: <params with 189687 characters>
:: <<< rust-analyzer 43: []
:: --> rust-analyzer textDocument/documentHighlight(44): {'textDocument': {'uri': 'file:///home/paul/aa/workspaces/rust_workspace/gigasecond/src/lib.rs'}, 'position': {'line': 44, 'character': 1}}
:: <<< rust-analyzer 44: None
From the ST console the only logging referencing rust-analyzer is: LSP: enabled configs: rust-analyzer LSP: disabled configs: clangd, dart, elixir-ls, erlang-ls, flow, gopls, haskell-ide-engine, jdtls, ocaml, polymer-ide, pyls, rlang, ruby, sorbet, sourcekit-lsp GoSublime r18.07.22-1: gs.init() GoSublime r18.07.22-1: sh.init() LSP: starting ['rust-analyzer'] in /home/paul/aa/workspaces/rust_workspace/gigasecond LSP: rust-analyzer: supported code action kinds: ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite'] reloading settings Packages/User/deviot.sublime-settings LSP: rust-analyzer: registering capability: textDocumentSync.save
LSP.sublime-settings: { // Show permanent language server status in the status bar. "show_view_status": true,
// Open and close the diagnostics panel automatically, // depending on available diagnostics. // Valid values are "never", "always" and "saved" "auto_show_diagnostics_panel": "saved",
// Run the server's formatProvider (if supported) on a document before saving. // This option is also supported in syntax-specific settings and/or in the // "settings" section of project files. "lsp_format_on_save": false,
// A dictionary of code action identifiers that should be triggered on save.
//
// Code action identifiers are not officially standardized so refer to specific
// server's documentation on what is supported but source.fixAll
is commonly
// used to apply fix-on-save code actions.
//
// This option is also supported in syntax-specific settings and/or in the
// "settings" section of project files. Settings from all those places will be
// merged and more specific (syntax and project) settings will override less
// specific (from LSP or Sublime settings).
//
// Only "source.*" actions are supported.
"lsp_code_actions_on_save": {
// "source.fixAll": true,
// "source.organizeImports": true,
},
// The amount of time the code actions on save are allowed to run for. "code_action_on_save_timeout_ms": 2000,
// Open the diagnostics panel automatically // when diagnostics level is equal to or less than: // error: 1 // warning: 2 // info: 3 // hint: 4 "auto_show_diagnostics_panel_level": 2,
// Show errors and warnings count in the status bar "show_diagnostics_count_in_view_status": false,
// Show the diagnostics description of the code // under the cursor in status bar if available. "show_diagnostics_in_view_status": true,
// Show highlights and gutter markers in the file views for diagnostics // with level equal to or less than: // none: 0 // error: 1 // warning: 2 // info: 3 // hint: 4 "show_diagnostics_severity_level": 4,
// Only show diagnostics in the panel with level equal to or less than: // error: 1 // warning: 2 // info: 3 // hint: 4 "diagnostics_panel_include_severity_level": 4,
// Delay showing diagnostics by this many milliseconds. // The delay will only kick into action when previously there were // no diagnostics in the view. If there were previous diagnostics in the view, // then the delay setting here is ignored and diagnostics are updated // immediately. "diagnostics_delay_ms": 0,
// Add an additional delay when the auto-complete widget is currently visible. // Just like the above "diagnostics_delay_ms", the unit is milliseconds. // The total amount of delay would be // // diagnostics_delay_ms + diagnostics_additional_delay_auto_complete_ms // // See also: "diagnostics_delay_ms". "diagnostics_additional_delay_auto_complete_ms": 0,
// Highlighting style of code diagnostics. // Valid values are "fill", "box", "underline", "stippled", "squiggly" or "". // When set to the empty string (""), no diagnostics are shown in-line. "diagnostics_highlight_style": "squiggly",
// Highlighting style of "highlights": accentuating nearby text entities that // are related to the one under your cursor. // Valid values are "fill", "box", "underline", "stippled", "squiggly" or "". // When set to the empty string (""), no document highlighting is requested. "document_highlight_style": "underline",
"document_highlight_scopes": { "unknown": "text", "text": "text", "read": "markup.inserted", "write": "markup.changed" },
// Gutter marker for code diagnostics. // Valid values are "dot", "circle", "bookmark", "sign" or "" "diagnostics_gutter_marker": "dot",
// Show code actions: // "annotation" - show an annotation on the right when code actions are available. // "bulb" - show a bulb in the gutter when code actions are available. // Note: Due to API limitations, the "bulb" icon can not be clicked so the code actions can only be triggered // using a keyboard shortcut or the context menu. "show_code_actions": "annotation",
// Show symbol action links in hover popup if available "show_symbol_action_links": false,
// Disable Sublime Text's snippet completions. "inhibit_snippet_completions": false,
// Disable Sublime Text's word completions. When set to true
, this also disables Sublime Text's internal completion
// sorting algorithm and instead uses the sorting defined by the relevant language server.
"inhibit_word_completions": true,
// Show symbol references in Sublime's quick panel instead of the bottom panel. "show_references_in_quick_panel": false,
// Disable language client capabilities. Supported values: // "hover", "completion", "colorProvider", "documentHighlight", "signatureHelp" "disabled_capabilities": [],
// Show verbose debug messages in the sublime console. "log_debug": false,
// Log communication from and to language servers. // Set to an array of values: // - "panel" - log to the LSP Language Servers output panel // - "remote" - start a local websocket server on port 9981. Can be connected to with // a websocket client to receive the log messages in real time. // For backward-compatibility, when set to "true", enables the "panel" logger and when // set to "false" disables logging. // This output panel can be toggled from the command palette with the // command "LSP: Toggle Log Panel". "log_server": [ // "panel", // "remote", ],
// Show language server stderr output in the Language Servers output panel. // This output panel can be toggled from the command palette with the // command "LSP: Toggle Log Panel". "log_stderr": false,
// When logging to the "panel" (see "log_server"), if the params of the request or
// response or notification exceed this many characters, then print a
// User clients configuration can be used to // - override single settings of "default_clients" // - create add new user specified clients // // "clients": // { // // Each new client must have the following structure. // "client_name": // { // # Must-have settings (for new clients): // // // The command line required to run the server. // "command": ["pyls"], // // // Use: "Show Scope Name" from Sublime's Developer menu // // This is the connection between your files and language servers. It's a selector that is matched // // against the current view's base scope. If the selector matches with the base scope of the // // the file, the associated language server is started. // // If the selector happens to be of the form "source.{languageId}" (which it is in many cases), then you can // // omit this "selector" key altogether, and LSP will assume the selector is "source.{languageId}". // // For more information, see https://www.sublimetext.com/docs/3/selectors.html // "document_selector": "source.python", // // // See: https://microsoft.github.io/language-server-protocol/specification#textDocumentItem // // // // This key serves two purposes: // // 1. It is sent to the language server so that it knows with what kind of file it is dealing with. // // 2. When "selector" is not provided (see above), this is the connection between your files and language // // servers. // // // // In this particular example, we don't have to supply a "selector" key, because the selector for a Python file // // is "source.python" (see above). // "languageId": "python", // // // When you want to connect to the language server via TCP (on localhost), specify the port here. // // If you put a value of 0 here, then LSP will select a free port number on localhost. In that case, you can // // use the string templates $port or ${port} in the "command". // // The syntax "{port}" is also allowed, but deprecated in favor of $port and ${port}. // "tcp_port": 1234, // // # Optional settings (key-value pairs): // // // Sent to server once using workspace/didChangeConfiguration notification // "settings": { }, // // // Sent once to server in initialize request // "initializationOptions": { }, // // // Extra variables to override/add to language server's environment. // "env": { }, // } // } "clients": {},
// Default clients configuration // DO NOT MODIFY THIS SETTING! // Use "clients" to override settings instead! "default_clients": { "pyls": { "command": [ "pyls" ], "languages": [ { "languageId": "python" } ], }, "rust-analyzer": { "command": [ "rust-analyzer" ], "languages": [ { "languageId": "rust" } ], }, "clangd": { "command": [ "clangd" ], "languages": [ { "languageId": "c" // will match source.c }, { "document_selector": "source.c++", "languageId": "cpp" }, { "document_selector": "source.objc", "languageId": "objective-c" }, { "document_selector": "source.objc++", "languageId": "objective-cpp" }, ] }, "dart": { "command": [ // Specify a dart command like the below in your LSP User settings. // "dart", "/usr/local/opt/dart/libexec/bin/snapshots/analysis_server.dart.snapshot", "--lsp" ], "languages": [ { "languageId": "dart" } ], }, "elixir-ls": { "command": [ // Specify path to language_server.sh from https://github.com/elixir-lsp/elixir-ls here // "/home/someUser/somePlace/elixir-ls/release/language_server.sh" ], "languages": [ { "languageId": "elixir" } ], "settings": {} }, "erlang-ls": { "command": [ "erlang_ls", "--transport", "stdio" ], "languages": [ { "languageId": "erlang" } ], }, "flow": { "command": [ "flow", "lsp" ], "languages": [ { "languageId": "javascript", "document_selector": "source.js" } ], }, "haskell-ide-engine": { "command": [ "hie", "--lsp" ], "languages": [ { "languageId": "haskell" } ], }, "ocaml": { "command": [ "ocaml-language-server", "--stdio" ], "languages": [ { "languageId": "reason" }, { "languageId": "ocaml" } ], }, "gopls": { "command": [ "gopls" ], "languages": [ { "languageId": "go" } ], }, "jdtls": { "command": [ "java", "-jar", "PATH_TO_JDT_SERVER/plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar", "-configuration", "PATH_TO_CONFIG_DIR" ], "languages": [ { "languageId": "java" } ], }, "polymer-ide": { "command": [ "polymer-editor-service" ], "languages": [ { "document_selector": "text.html.basic | source.html", "languageId": "html" }, { "document_selector": "source.js", "languageId": "javascript" }, { "languageId": "css" // will match source.css }, { "languageId": "json" // will match source.json } ], "settings": { "polymer-ide.analyzeWholePackage": false, "polymer-ide.fixOnSave": false } }, "ruby": { "command": [ "solargraph", "stdio" ], "languages": [ { "languageId": "ruby", "document_selector": "source.ruby | text.html.ruby" } ], "initializationOptions": { "diagnostics": false }, }, "sorbet": { "command": [ "srb", "tc", "--typed", "true", "--enable-all-experimental-lsp-features", "--lsp", "--disable-watchman" ], "languages": [ { "languageId": "ruby", "document_selector": "source.ruby | text.html.ruby" } ], }, "rlang": { "command": [ "R", "--slave", "-e", "languageserver::run()" ], "languages": [ { "languageId": "r" } ], }, "sourcekit-lsp": { "command": [ "xcrun", "sourcekit-lsp" ], "languages": [ { "languageId": "swift" } ], }, } }
LSP.sublime-settings (user file): { "log_debug": true, "log_server": [ "panel", ],
"clients":
{
"rust-analyzer":
{
"command":
[
"rust-analyzer"
],
"enabled": true,
"languageId": "rust",
"scopes":
[
"source.rust"
],
"syntaxes":
[
//"Packages/Rust/Rust.sublime-syntax",
"Packages/Rust Enhanced/RustEnhanced.sublime-syntax"
],
},
},
}
If I rollback to ST3 it all works fine (code complete pop up shows) once the correct version of LSP is installed, but whenever I roll forward to ST4 it doesn't. One odd thing is that neither of the global LSP settings files (settings and keys) seems to exist on the file system, not sure if that is an expected.
I've seen a couple of people online saying it all works fine but they have been on a mac rather than linux.
Is it possible another package interferes with the auto-complete widget? I can clearly see a complete request in the logs. So it should be working. Please list your installed packages.
I agree with @rwols:
LSP sends the completion request and gets the response, which means that you should see the autocomplete popup.
:: --> rust-analyzer textDocument/completion(42): {'textDocument': {'uri': 'file:///home/paul/aa/workspaces/rust_workspace/gigasecond/src/lib.rs'}, 'position': {'line': 44, 'character': 1}}
:: <<< rust-analyzer 42: <params with 189687 characters>
Do you have maybe rust-enhanced installed? If so I would say that LSP is conflicting with that plugin, or another plugin.
I think that I have sorted the issue, the new version of ST, ST4 reused the same config as ST3 ie did not create a new folder for ST4 and migrate.
Under ~/.config/sublime-text-3/Cache there was an LSP folder, deleting that seems to have solved the problem. ST4 recreated the Cache/LSP folder and contents and now code completion seems to be working fine, happy for this to be closed.
I should probably delete the whole Cache folder I suspect and let ST4 recreate all of the contents.
Thanks for looking at this, the fact that it was working for you allowed me to look again at my setup.
predragnikolic/rwols - closing this as it is an issue with some cached files that were not cleared by ST4 on install.
The autocomplete popup does not show using ST4 on linux. This works as expected on ST3 - 3210 with lsp v.0.13.0
To Reproduce Steps to reproduce the behavior: eg in ST3 typing "pr" shows println, print! etc in a pop up as expected, the pop up does not show at all in ST4
Expected behavior on typing eg "pr" a pop up should display with various possible code completions
Screenshots Not possible as the pop up disappears on attempt to take on ST3 and doesn't show at all in ST4
Environment (please complete the following information):
Additional context N/A