mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Add cargo-watch.check-arguments
This commit is contained in:
parent
ee05eafe6c
commit
02e450f354
6 changed files with 139 additions and 74 deletions
16
editors/code/src/commands/line_buffer.ts
Normal file
16
editors/code/src/commands/line_buffer.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
export class LineBuffer {
|
||||
private outBuffer: string = '';
|
||||
|
||||
public processOutput(chunk: string, cb: (line: string) => void) {
|
||||
this.outBuffer += chunk;
|
||||
let eolIndex = this.outBuffer.indexOf('\n');
|
||||
while (eolIndex >= 0) {
|
||||
// line includes the EOL
|
||||
const line = this.outBuffer.slice(0, eolIndex + 1);
|
||||
cb(line);
|
||||
this.outBuffer = this.outBuffer.slice(eolIndex + 1);
|
||||
|
||||
eolIndex = this.outBuffer.indexOf('\n');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue