File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -353,7 +353,10 @@ async function refreshDiagnostics(result: ResultType) {
353353 globalDiagnostics
354354 )
355355
356- for ( const path in result . files ) {
356+ // https://github.com/phpstan/phpstan-src/blob/6d228a53/src/Analyser/MutatingScope.php#L289
357+ const contextRegex = / \( i n c o n t e x t o f .+ \) $ /
358+
359+ for ( let path in result . files ) {
357360 const pathItem = result . files [ path ]
358361 const diagnostics : vscode . Diagnostic [ ] = [ ]
359362 for ( const messageItem of pathItem . messages ) {
@@ -367,6 +370,11 @@ async function refreshDiagnostics(result: ResultType) {
367370
368371 diagnostics . push ( diagnostic )
369372 }
373+
374+ const matches = contextRegex . exec ( path )
375+
376+ if ( matches ) path = path . slice ( 0 , matches . index )
377+
370378 $ . diagnosticCollection . set ( vscode . Uri . file ( path ) , diagnostics )
371379 }
372380}
You can’t perform that action at this time.
0 commit comments