mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
⬆️ rust-analyzer
This commit is contained in:
parent
3e0e51c108
commit
bc45c7659a
321 changed files with 11210 additions and 9720 deletions
|
@ -117,7 +117,7 @@ export function isValidExecutable(path: string): boolean {
|
|||
|
||||
const res = spawnSync(path, ["--version"], { encoding: "utf8" });
|
||||
|
||||
const printOutput = res.error && (res.error as any).code !== "ENOENT" ? log.warn : log.debug;
|
||||
const printOutput = res.error ? log.warn : log.info;
|
||||
printOutput(path, "--version:", res);
|
||||
|
||||
return res.status === 0;
|
||||
|
@ -166,3 +166,49 @@ export function execute(command: string, options: ExecOptions): Promise<string>
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
export class LazyOutputChannel implements vscode.OutputChannel {
|
||||
constructor(name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
name: string;
|
||||
_channel: vscode.OutputChannel | undefined;
|
||||
|
||||
get channel(): vscode.OutputChannel {
|
||||
if (!this._channel) {
|
||||
this._channel = vscode.window.createOutputChannel(this.name);
|
||||
}
|
||||
return this._channel;
|
||||
}
|
||||
|
||||
append(value: string): void {
|
||||
this.channel.append(value);
|
||||
}
|
||||
appendLine(value: string): void {
|
||||
this.channel.appendLine(value);
|
||||
}
|
||||
replace(value: string): void {
|
||||
this.channel.replace(value);
|
||||
}
|
||||
clear(): void {
|
||||
if (this._channel) {
|
||||
this._channel.clear();
|
||||
}
|
||||
}
|
||||
show(preserveFocus?: boolean): void;
|
||||
show(column?: vscode.ViewColumn, preserveFocus?: boolean): void;
|
||||
show(column?: any, preserveFocus?: any): void {
|
||||
this.channel.show(column, preserveFocus);
|
||||
}
|
||||
hide(): void {
|
||||
if (this._channel) {
|
||||
this._channel.hide();
|
||||
}
|
||||
}
|
||||
dispose(): void {
|
||||
if (this._channel) {
|
||||
this._channel.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue