Found an issue with diagnostics going missing when editing a file.
it.only('lsp bug', () => {
program.options.autoImportComponentScript = true;
program.setFile('components/playerInterfaces.bs', `
interface MediaObject
optional url as string
end interface
`);
program.setFile('components/player.xml', `
<component name="Player" extends="Group">
</component>
`);
program.setFile('components/player.bs', `
import "playerInterfaces.bs"
import "playerUtils.bs"
sub test()
media = {} as MediaObject
print media.missingBool1
end sub
`);
program.setFile('components/playerUtils.bs', `
import "playerInterfaces.bs"
function test1(media as MediaObject) as boolean
print media.missingBool2
end function
`);
program.validate();
//we have both diagnostics
expectDiagnostics(program, [
DiagnosticMessages.cannotFindName('missingBool1', undefined, 'MediaObject').message,
DiagnosticMessages.cannotFindName('missingBool2', undefined, 'MediaObject').message
]);
//add the last file again thus "opening" it.
program.setFile('components/playerUtils.bs', `
import "playerInterfaces.bs"
function test2(media as MediaObject) as boolean
print media.missingBool2
end function
`);
program.validate();
//we STILL have both diagnostics
expectDiagnostics(program, [
DiagnosticMessages.cannotFindName('missingBool1', undefined, 'MediaObject').message,
DiagnosticMessages.cannotFindName('missingBool2', undefined, 'MediaObject').message
]);
});
Found an issue with diagnostics going missing when editing a file.