fix status item not shown with javascript document

This commit is contained in:
chemzqm 2019-04-05 11:37:43 +08:00
parent 37ef82a0aa
commit e76a4ef550
2 changed files with 8 additions and 3 deletions

View file

@ -105,7 +105,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
this.versionProvider = new TypeScriptVersionProvider(this._configuration)
this._apiVersion = API.defaultVersion
this.tracer = new Tracer(this.logger)
this.versionStatus = new VersionStatus(this.normalizePath.bind(this))
this.versionStatus = new VersionStatus(this.normalizePath.bind(this), this.fileConfigurationManager.enableJavascript())
pluginManager.onDidUpdateConfig(update => {
this.configurePlugin(update.pluginId, update.config)
}, null, this.disposables)

View file

@ -8,7 +8,8 @@ export default class VersionStatus {
private readonly _versionBarEntry: StatusBarItem
constructor(
private readonly _normalizePath: (resource: Uri) => string | null
private readonly _normalizePath: (resource: Uri) => string | null,
private readonly enableJavascript: boolean
) {
this._versionBarEntry = workspace.createStatusBarItem(99)
this._onChangeEditorSub = events.on('BufEnter', this.showHideStatus, this)
@ -33,8 +34,12 @@ export default class VersionStatus {
this._versionBarEntry.hide()
return
}
let filetypes = ['typescript', 'typescriptreact']
if (this.enableJavascript) {
filetypes.push('javascript', 'javascriptreact')
}
if (['typescript', 'typescriptreact'].indexOf(document.filetype) !== -1) {
if (filetypes.indexOf(document.filetype) !== -1) {
if (this._normalizePath(Uri.parse(document.uri))) {
this._versionBarEntry.show()
} else {