fix match of terminal uri

This commit is contained in:
chemzqm 2018-12-14 21:19:26 +08:00
parent 44f55c6167
commit 01ccf2cc6d

View file

@ -42,7 +42,7 @@ class WatchCommand implements Command {
} }
let { nvim } = workspace let { nvim } = workspace
nvim.setVar('tsc_status', s, true) nvim.setVar('tsc_status', s, true)
nvim.command('redraws') nvim.command('redraws', true)
} }
public async execute(): Promise<void> { public async execute(): Promise<void> {
@ -115,14 +115,14 @@ class WatchCommand implements Command {
} }
} }
for (let line of doc.content.split('\n')) { for (let line of doc.content.split('\n')) {
parseLine(line) parseLine(line) // tslint:disable-line
} }
doc.onDocumentChange(e => { doc.onDocumentChange(e => {
let { contentChanges } = e let { contentChanges } = e
for (let change of contentChanges) { for (let change of contentChanges) {
let lines = change.text.split('\n') let lines = change.text.split('\n')
for (let line of lines) { for (let line of lines) {
parseLine(line) parseLine(line) // tslint:disable-line
} }
} }
}) })
@ -142,30 +142,26 @@ export default class WatchProject implements Disposable {
workspace.documents.forEach(doc => { workspace.documents.forEach(doc => {
let { uri } = doc let { uri } = doc
if (this.isTscBuffer(uri)) { if (this.isTscBuffer(uri)) {
cmd.onTerminalCreated(doc).catch(_e => { cmd.onTerminalCreated(doc) // tslint:disable-line
// noop
})
} }
}) })
workspace.onDidOpenTextDocument(doc => { workspace.onDidOpenTextDocument(doc => {
let { uri } = doc let { uri } = doc
if (this.isTscBuffer(uri)) { if (this.isTscBuffer(uri)) {
cmd.onTerminalCreated(workspace.getDocument(uri)).catch(_e => { cmd.onTerminalCreated(workspace.getDocument(uri)) // tslint:disable-line
// noop
})
} }
}, this, this.disposables) }, this, this.disposables)
workspace.onDidCloseTextDocument(doc => { workspace.onDidCloseTextDocument(doc => {
let { uri } = doc let { uri } = doc
if (this.isTscBuffer(uri)) { if (this.isTscBuffer(uri)) {
workspace.nvim.setVar('tsc_status', 'init', true) workspace.nvim.setVar('tsc_status', 'init', true)
workspace.nvim.command('redraws') workspace.nvim.command('redraws', true)
} }
}, this, this.disposables) }, this, this.disposables)
} }
private isTscBuffer(uri: string): boolean { private isTscBuffer(uri: string): boolean {
return uri.startsWith('term://') && uri.indexOf(TSC) !== -1 return uri.startsWith('term:/') && uri.indexOf(TSC) !== -1
} }
public dispose(): void { public dispose(): void {