Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove .file prop from BsDiagnostic #1155

Closed
TwitchBronBron opened this issue May 3, 2024 · 3 comments
Closed

Remove .file prop from BsDiagnostic #1155

TwitchBronBron opened this issue May 3, 2024 · 3 comments
Milestone

Comments

@TwitchBronBron
Copy link
Member

TwitchBronBron commented May 3, 2024

When #1136 lands, we should consider removing file from the BsDiagnostic interface. It doesn't feel right being attached to a diagnostic, and we could easily update DiagnosticsManager to support returning a new object that includes the scope/file information (i.e. the file) for a diagnostic) if we need that information.

This would be a breaking change, so likely should be done as part of v1.

@TwitchBronBron TwitchBronBron added this to the v1.0.0 milestone May 3, 2024
@markwpearce
Copy link
Collaborator

Not really sure how this works. How do we associate with a diagnostic with a file? Do we use the Location property on the Diagnostic.relatedInformation?

@TwitchBronBron
Copy link
Member Author

All diagnostics flow through the diagnosticManager now. So file would be a required property when registering a diagnostic. Something like this:

program.diagnostics.register({
    ...DiagnosticMessages.cannotFindName('someVar'),
}, {
    file: theFile,
});

Then if we need to know what file that diagnostic comes from, that would be an attribute of the return value from the diagnostic manager. Perhaps something like this?:

diagnosticManager.getDiagnosticsByFile(); // Map<BscFile, Diagnostic[]>; 

@markwpearce
Copy link
Collaborator

We decided that we should replace .file and .range with .location to mirror the changes in the AST Nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants