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

feat(lsp): ts language service scopes #24345

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

nayeemrmn
Copy link
Collaborator

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>>>,
Copy link
Member

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?

Copy link
Member

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);
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Member

@dsherret dsherret left a 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,
Copy link
Member

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)

cli/tsc/99_main_compiler.js Outdated Show resolved Hide resolved
@nayeemrmn nayeemrmn merged commit 67dcd6d into denoland:main Jun 26, 2024
17 checks passed
@nayeemrmn nayeemrmn deleted the lsp-tsc-deno-json-scopes branch June 26, 2024 22:52
@sant123
Copy link

sant123 commented Jun 27, 2024

Thank you so much 🙏🏼

sbmsr pushed a commit to sbmsr/deno-1 that referenced this pull request Jul 2, 2024
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants