aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/cargo_watch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/cargo_watch.ts')
-rw-r--r--editors/code/src/commands/cargo_watch.ts34
1 files changed, 17 insertions, 17 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 59d4ba97a..512362eb1 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -9,13 +9,13 @@ import { StatusDisplay } from './watch_status';
9 9
10import { 10import {
11 mapRustDiagnosticToVsCode, 11 mapRustDiagnosticToVsCode,
12 RustDiagnostic 12 RustDiagnostic,
13} from '../utils/diagnostics/rust'; 13} from '../utils/diagnostics/rust';
14import SuggestedFixCollection from '../utils/diagnostics/SuggestedFixCollection'; 14import SuggestedFixCollection from '../utils/diagnostics/SuggestedFixCollection';
15import { areDiagnosticsEqual } from '../utils/diagnostics/vscode'; 15import { areDiagnosticsEqual } from '../utils/diagnostics/vscode';
16 16
17export async function registerCargoWatchProvider( 17export async function registerCargoWatchProvider(
18 subscriptions: vscode.Disposable[] 18 subscriptions: vscode.Disposable[],
19): Promise<CargoWatchProvider | undefined> { 19): Promise<CargoWatchProvider | undefined> {
20 let cargoExists = false; 20 let cargoExists = false;
21 21
@@ -30,7 +30,7 @@ export async function registerCargoWatchProvider(
30 30
31 if (!cargoExists) { 31 if (!cargoExists) {
32 vscode.window.showErrorMessage( 32 vscode.window.showErrorMessage(
33 `Couldn\'t find \'Cargo.toml\' at ${cargoTomlPath}` 33 `Couldn\'t find \'Cargo.toml\' at ${cargoTomlPath}`,
34 ); 34 );
35 return; 35 return;
36 } 36 }
@@ -52,13 +52,13 @@ export class CargoWatchProvider implements vscode.Disposable {
52 52
53 constructor() { 53 constructor() {
54 this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 54 this.diagnosticCollection = vscode.languages.createDiagnosticCollection(
55 'rustc' 55 'rustc',
56 ); 56 );
57 this.statusDisplay = new StatusDisplay( 57 this.statusDisplay = new StatusDisplay(
58 Server.config.cargoWatchOptions.command 58 Server.config.cargoWatchOptions.command,
59 ); 59 );
60 this.outputChannel = vscode.window.createOutputChannel( 60 this.outputChannel = vscode.window.createOutputChannel(
61 'Cargo Watch Trace' 61 'Cargo Watch Trace',
62 ); 62 );
63 63
64 // Track `rustc`'s suggested fixes so we can convert them to code actions 64 // Track `rustc`'s suggested fixes so we can convert them to code actions
@@ -68,15 +68,15 @@ export class CargoWatchProvider implements vscode.Disposable {
68 this.suggestedFixCollection, 68 this.suggestedFixCollection,
69 { 69 {
70 providedCodeActionKinds: 70 providedCodeActionKinds:
71 SuggestedFixCollection.PROVIDED_CODE_ACTION_KINDS 71 SuggestedFixCollection.PROVIDED_CODE_ACTION_KINDS,
72 } 72 },
73 ); 73 );
74 } 74 }
75 75
76 public start() { 76 public start() {
77 if (this.cargoProcess) { 77 if (this.cargoProcess) {
78 vscode.window.showInformationMessage( 78 vscode.window.showInformationMessage(
79 'Cargo Watch is already running' 79 'Cargo Watch is already running',
80 ); 80 );
81 return; 81 return;
82 } 82 }
@@ -95,7 +95,7 @@ export class CargoWatchProvider implements vscode.Disposable {
95 95
96 const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce( 96 const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce(
97 (flags, pattern) => [...flags, '--ignore', pattern], 97 (flags, pattern) => [...flags, '--ignore', pattern],
98 [] as string[] 98 [] as string[],
99 ); 99 );
100 100
101 // Start the cargo watch with json message 101 // Start the cargo watch with json message
@@ -105,8 +105,8 @@ export class CargoWatchProvider implements vscode.Disposable {
105 { 105 {
106 stdio: ['ignore', 'pipe', 'pipe'], 106 stdio: ['ignore', 'pipe', 'pipe'],
107 cwd: vscode.workspace.rootPath, 107 cwd: vscode.workspace.rootPath,
108 windowsVerbatimArguments: true 108 windowsVerbatimArguments: true,
109 } 109 },
110 ); 110 );
111 111
112 const stdoutData = new LineBuffer(); 112 const stdoutData = new LineBuffer();
@@ -130,7 +130,7 @@ export class CargoWatchProvider implements vscode.Disposable {
130 130
131 this.cargoProcess.on('error', (err: Error) => { 131 this.cargoProcess.on('error', (err: Error) => {
132 this.logError( 132 this.logError(
133 'Error on cargo-watch process : {\n' + err.message + '}\n' 133 'Error on cargo-watch process : {\n' + err.message + '}\n',
134 ); 134 );
135 }); 135 });
136 136
@@ -223,12 +223,12 @@ export class CargoWatchProvider implements vscode.Disposable {
223 const fileUri = location.uri; 223 const fileUri = location.uri;
224 224
225 const diagnostics: vscode.Diagnostic[] = [ 225 const diagnostics: vscode.Diagnostic[] = [
226 ...(this.diagnosticCollection!.get(fileUri) || []) 226 ...(this.diagnosticCollection!.get(fileUri) || []),
227 ]; 227 ];
228 228
229 // If we're building multiple targets it's possible we've already seen this diagnostic 229 // If we're building multiple targets it's possible we've already seen this diagnostic
230 const isDuplicate = diagnostics.some(d => 230 const isDuplicate = diagnostics.some(d =>
231 areDiagnosticsEqual(d, diagnostic) 231 areDiagnosticsEqual(d, diagnostic),
232 ); 232 );
233 if (isDuplicate) { 233 if (isDuplicate) {
234 return; 234 return;
@@ -241,7 +241,7 @@ export class CargoWatchProvider implements vscode.Disposable {
241 for (const suggestedFix of suggestedFixes) { 241 for (const suggestedFix of suggestedFixes) {
242 this.suggestedFixCollection.addSuggestedFixForDiagnostic( 242 this.suggestedFixCollection.addSuggestedFixForDiagnostic(
243 suggestedFix, 243 suggestedFix,
244 diagnostic 244 diagnostic,
245 ); 245 );
246 } 246 }
247 247
@@ -249,7 +249,7 @@ export class CargoWatchProvider implements vscode.Disposable {
249 vscode.commands.executeCommand( 249 vscode.commands.executeCommand(
250 'vscode.executeCodeActionProvider', 250 'vscode.executeCodeActionProvider',
251 fileUri, 251 fileUri,
252 diagnostic.range 252 diagnostic.range,
253 ); 253 );
254 } 254 }
255 } 255 }