-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(lsp): ts language service scopes #24345
Conversation
has_injected_types_node_package: bool, | ||
/// Config scopes that contain a node: specifier such that a @types/node | ||
/// package should be injected. | ||
scopes_with_node_specifier: Arc<HashSet<Option<ModuleSpecifier>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little strange to see a hashmap containing an Option. Maybe we should bury this behaviour within a struct and make the public api of the struct better explain what's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nvm, I see what this means. We may want to give Option<ModuleSpecifier>
a name like ScopeKey
or something?
all_locations.extend(locations); | ||
} | ||
if all_locations.is_empty() { | ||
return Ok(None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why this returns an option. Is something relying on this returning None
? Maybe we can just return a vec now? If not, it looks like the behaviour might have changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just preserving the TS API (https://github.com/denoland/deno/blob/v1.37.1/cli/tsc/dts/typescript.d.ts#L6228), which probably tries to match the LSP API. With all of our intermediate plumbing it's basically meaningless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
languageServiceEntries.unscoped = { | ||
ls: ts.createLanguageService( | ||
host, | ||
documentRegistry, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good (that it's shared)
Thank you so much 🙏🏼 |
Closes denoland/vscode_deno#488.
Closes #24293.