diff options
Diffstat (limited to 'src/tools/rust-analyzer/editors/code')
| -rw-r--r-- | src/tools/rust-analyzer/editors/code/package.json | 63 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/editors/code/src/config.ts | 14 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/editors/code/src/main.ts | 4 |
3 files changed, 48 insertions, 33 deletions
diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json index a13798d8b36..fbdc69c8013 100644 --- a/src/tools/rust-analyzer/editors/code/package.json +++ b/src/tools/rust-analyzer/editors/code/package.json @@ -99,142 +99,142 @@ { "command": "rust-analyzer.syntaxTree", "title": "Show Syntax Tree", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.viewHir", "title": "View Hir", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.viewFileText", "title": "View File Text (as seen by the server)", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.viewItemTree", "title": "Debug ItemTree", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.viewCrateGraph", "title": "View Crate Graph", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.viewFullCrateGraph", "title": "View Crate Graph (Full)", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.expandMacro", "title": "Expand macro recursively", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.matchingBrace", "title": "Find matching brace", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.parentModule", "title": "Locate parent module", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.joinLines", "title": "Join lines", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.run", "title": "Run", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.copyRunCommandLine", "title": "Copy Run Command Line", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.debug", "title": "Debug", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.newDebugConfig", "title": "Generate launch configuration", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.analyzerStatus", "title": "Status", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.memoryUsage", "title": "Memory Usage (Clears Database)", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.shuffleCrateGraph", "title": "Shuffle Crate Graph", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.reloadWorkspace", "title": "Reload workspace", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.reload", "title": "Restart server", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.onEnter", "title": "Enhanced enter key", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.ssr", "title": "Structural Search Replace", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.serverVersion", "title": "Show RA Version", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.toggleInlayHints", "title": "Toggle inlay hints", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.openDocs", "title": "Open docs under cursor", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.openCargoToml", "title": "Open Cargo.toml", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.peekTests", "title": "Peek related tests", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.moveItemUp", "title": "Move item up", - "category": "Rust Analyzer" + "category": "rust-analyzer" }, { "command": "rust-analyzer.moveItemDown", "title": "Move item down", - "category": "Rust Analyzer" + "category": "rust-analyzer" } ], "keybindings": [ @@ -256,7 +256,7 @@ ], "configuration": { "type": "object", - "title": "Rust Analyzer", + "title": "rust-analyzer", "properties": { "rust-analyzer.cargoRunner": { "type": [ @@ -380,6 +380,11 @@ "default": false, "type": "boolean" }, + "rust-analyzer.typing.continueCommentsOnNewline": { + "markdownDescription": "Whether to prefix newlines after comments with the corresponding comment prefix.", + "default": true, + "type": "boolean" + }, "$generated-start": {}, "rust-analyzer.assist.expressionFillDefault": { "markdownDescription": "Placeholder expression to use for missing expressions in assists.", diff --git a/src/tools/rust-analyzer/editors/code/src/config.ts b/src/tools/rust-analyzer/editors/code/src/config.ts index b04f18890b9..1c58040d58c 100644 --- a/src/tools/rust-analyzer/editors/code/src/config.ts +++ b/src/tools/rust-analyzer/editors/code/src/config.ts @@ -16,9 +16,13 @@ export class Config { readonly extensionId = "rust-lang.rust-analyzer"; readonly rootSection = "rust-analyzer"; - private readonly requiresWorkspaceReloadOpts = ["serverPath", "server"].map( - (opt) => `${this.rootSection}.${opt}` - ); + private readonly requiresWorkspaceReloadOpts = [ + "serverPath", + "server", + // FIXME: This shouldn't be here, changing this setting should reload + // `continueCommentsOnNewline` behavior without restart + "typing", + ].map((opt) => `${this.rootSection}.${opt}`); private readonly requiresReloadOpts = [ "cargo", "procMacro", @@ -140,6 +144,10 @@ export class Config { return this.get<boolean>("restartServerOnConfigChange"); } + get typingContinueCommentsOnNewline() { + return this.get<boolean>("typing.continueCommentsOnNewline"); + } + get debug() { let sourceFileMap = this.get<Record<string, string> | "auto">("debug.sourceFileMap"); if (sourceFileMap !== "auto") { diff --git a/src/tools/rust-analyzer/editors/code/src/main.ts b/src/tools/rust-analyzer/editors/code/src/main.ts index 9ae20ddc4ac..d78b711a47a 100644 --- a/src/tools/rust-analyzer/editors/code/src/main.ts +++ b/src/tools/rust-analyzer/editors/code/src/main.ts @@ -84,7 +84,9 @@ async function tryActivate(context: vscode.ExtensionContext): Promise<RustAnalyz warnAboutExtensionConflicts(); - ctx.pushCleanup(configureLanguage()); + if (config.typingContinueCommentsOnNewline) { + ctx.pushCleanup(configureLanguage()); + } vscode.workspace.onDidChangeConfiguration( (_) => |
