File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,25 @@ export = function ({ typescript: ts }: { typescript: typeof import('typescript/l
60
60
return info . languageService . getCompletionsAtPosition ( fileName , position , options )
61
61
}
62
62
63
+ const disableSyntaxErrorsInViewEditor = ( ) => {
64
+ if ( info . project . projectKind !== ts . server . ProjectKind . Inferred ) return
65
+ const openedFiles = [ ...( info . project . projectService . openFiles . keys ( ) as any ) ] as string [ ]
66
+ let ourFileRoot : string | undefined
67
+ for ( const openedFile of openedFiles ) {
68
+ const beforeRootIdx = openedFile . indexOf ( '/^/bettersnippets.virtualsnippets/' )
69
+ if ( beforeRootIdx === - 1 ) continue
70
+ ourFileRoot = openedFile . slice ( 0 , beforeRootIdx )
71
+ break
72
+ }
73
+ let currentRoot = info . languageServiceHost . getCurrentDirectory ( ) . toLowerCase ( )
74
+ if ( currentRoot === '/' ) currentRoot = ''
75
+ if ( ourFileRoot === undefined || currentRoot !== ourFileRoot ) {
76
+ return
77
+ }
78
+ proxy . getSyntacticDiagnostics = ( ) => [ ]
79
+ }
80
+ disableSyntaxErrorsInViewEditor ( )
81
+
63
82
return proxy
64
83
} ,
65
84
onConfigurationChanged ( config : any ) {
You can’t perform that action at this time.
0 commit comments