@@ -74,7 +74,7 @@ import {
74
74
FileWatcherEventHandler ,
75
75
FileWatcherEventType ,
76
76
} from './common/fileSystem' ;
77
- import { containsPath , convertPathToUri , convertUriToPath , getFileExtension } from './common/pathUtils' ;
77
+ import { containsPath , convertPathToUri , convertUriToPath } from './common/pathUtils' ;
78
78
import { ProgressReporter , ProgressReportTracker } from './common/progressReporter' ;
79
79
import { convertWorkspaceEdits } from './common/textEditUtils' ;
80
80
import { DocumentRange , Position } from './common/textRange' ;
@@ -776,35 +776,25 @@ export abstract class LanguageServerBase implements LanguageServerInterface {
776
776
this . _connection . onDidOpenTextDocument ( async ( params ) => {
777
777
const filePath = convertUriToPath ( params . textDocument . uri ) ;
778
778
const workspace = await this . getWorkspaceForFile ( filePath ) ;
779
- if ( this . _isSupportedSourceFileType ( filePath ) ) {
780
- workspace . serviceInstance . setFileOpened (
781
- filePath ,
782
- params . textDocument . version ,
783
- params . textDocument . text
784
- ) ;
785
- }
779
+ workspace . serviceInstance . setFileOpened ( filePath , params . textDocument . version , params . textDocument . text ) ;
786
780
} ) ;
787
781
788
782
this . _connection . onDidChangeTextDocument ( async ( params ) => {
789
783
this . recordUserInteractionTime ( ) ;
790
784
791
785
const filePath = convertUriToPath ( params . textDocument . uri ) ;
792
786
const workspace = await this . getWorkspaceForFile ( filePath ) ;
793
- if ( this . _isSupportedSourceFileType ( filePath ) ) {
794
- workspace . serviceInstance . updateOpenFileContents (
795
- filePath ,
796
- params . textDocument . version ,
797
- params . contentChanges
798
- ) ;
799
- }
787
+ workspace . serviceInstance . updateOpenFileContents (
788
+ filePath ,
789
+ params . textDocument . version ,
790
+ params . contentChanges
791
+ ) ;
800
792
} ) ;
801
793
802
794
this . _connection . onDidCloseTextDocument ( async ( params ) => {
803
795
const filePath = convertUriToPath ( params . textDocument . uri ) ;
804
796
const workspace = await this . getWorkspaceForFile ( filePath ) ;
805
- if ( this . _isSupportedSourceFileType ( filePath ) ) {
806
- workspace . serviceInstance . setFileClosed ( filePath ) ;
807
- }
797
+ workspace . serviceInstance . setFileClosed ( filePath ) ;
808
798
} ) ;
809
799
810
800
this . _connection . onDidChangeWatchedFiles ( ( params ) => {
@@ -1131,15 +1121,6 @@ export abstract class LanguageServerBase implements LanguageServerInterface {
1131
1121
}
1132
1122
}
1133
1123
1134
- private _isSupportedSourceFileType ( filePath : string ) {
1135
- // The language server assumes that all source files are either ".py"
1136
- // or ".pyi" files. We don't want to attempt to parse other files
1137
- // (like binaries, etc.). And we need to know whether to use normal
1138
- // or stub semantics.
1139
- const extension = getFileExtension ( filePath ) . toLowerCase ( ) ;
1140
- return extension === '.py' || extension === '.pyi' ;
1141
- }
1142
-
1143
1124
private _getCompatibleMarkupKind ( clientSupportedFormats : MarkupKind [ ] | undefined ) {
1144
1125
const serverSupportedFormats = [ MarkupKind . PlainText , MarkupKind . Markdown ] ;
1145
1126
0 commit comments