mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 21:25:25 +00:00 
			
		
		
		
	Auto merge of #15707 - dfireBird:default-statusbar-action-config, r=lnicola
Add configuration for the default action of the status bar click action in VSCode Fixes #15441 Please suggest any changes if necessary.
This commit is contained in:
		
						commit
						b57658d9a9
					
				
					 3 changed files with 22 additions and 1 deletions
				
			
		| 
						 | 
					@ -371,6 +371,19 @@
 | 
				
			||||||
                    ],
 | 
					                    ],
 | 
				
			||||||
                    "markdownDescription": "Problem matchers to use for `rust-analyzer.run` command, eg `[\"$rustc\", \"$rust-panic\"]`."
 | 
					                    "markdownDescription": "Problem matchers to use for `rust-analyzer.run` command, eg `[\"$rustc\", \"$rust-panic\"]`."
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
 | 
					                "rust-analyzer.statusBar.clickAction": {
 | 
				
			||||||
 | 
					                    "type": "string",
 | 
				
			||||||
 | 
					                    "enum": [
 | 
				
			||||||
 | 
					                        "stopServer",
 | 
				
			||||||
 | 
					                        "openLogs"
 | 
				
			||||||
 | 
					                    ],
 | 
				
			||||||
 | 
					                    "enumDescriptions": [
 | 
				
			||||||
 | 
					                        "Stop Server",
 | 
				
			||||||
 | 
					                        "Open Logs"
 | 
				
			||||||
 | 
					                    ],
 | 
				
			||||||
 | 
					                    "default": "openLogs",
 | 
				
			||||||
 | 
					                    "markdownDescription": "Action to run when clicking the extension status bar item."
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
                "rust-analyzer.server.path": {
 | 
					                "rust-analyzer.server.path": {
 | 
				
			||||||
                    "type": [
 | 
					                    "type": [
 | 
				
			||||||
                        "null",
 | 
					                        "null",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -329,6 +329,10 @@ export class Config {
 | 
				
			||||||
    get showDependenciesExplorer() {
 | 
					    get showDependenciesExplorer() {
 | 
				
			||||||
        return this.get<boolean>("showDependenciesExplorer");
 | 
					        return this.get<boolean>("showDependenciesExplorer");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    get statusBarClickAction() {
 | 
				
			||||||
 | 
					        return this.get<string>("statusBar.clickAction");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// the optional `cb?` parameter is meant to be used to add additional
 | 
					// the optional `cb?` parameter is meant to be used to add additional
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -400,7 +400,11 @@ export class Ctx {
 | 
				
			||||||
                statusBar.tooltip.appendText(status.message ?? "Ready");
 | 
					                statusBar.tooltip.appendText(status.message ?? "Ready");
 | 
				
			||||||
                statusBar.color = undefined;
 | 
					                statusBar.color = undefined;
 | 
				
			||||||
                statusBar.backgroundColor = undefined;
 | 
					                statusBar.backgroundColor = undefined;
 | 
				
			||||||
                statusBar.command = "rust-analyzer.openLogs";
 | 
					                if (this.config.statusBarClickAction === "stopServer") {
 | 
				
			||||||
 | 
					                    statusBar.command = "rust-analyzer.stopServer";
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    statusBar.command = "rust-analyzer.openLogs";
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                this.dependencies?.refresh();
 | 
					                this.dependencies?.refresh();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "warning":
 | 
					            case "warning":
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue