Skip to content

Send updated sourceFile to getLiteralText #59141

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

Closed

Conversation

armanio123
Copy link
Contributor

Fixes #59085 (comment)

When the node's sourceFile is not the same as the currentSourceFile the method returns an incorrect position. In example, in the code below, the position will hit the comment text in foo.ts instead of bar.ts.

// @Filename: foo.ts
// Some comment that is going to be used instead on the correct ['constructor'] text.
import { Bar } from "./bar";

export class Foo extends Bar {
    // | <-- trigger completions here should show ['constructor'] from bar.ts. Instead, crashes.
}

// @Filename: bar.ts
export class ElementNode {
    ['constructor']!: any;
}

Note that I unsuccessfully tried creating the repro as a fourslash test but for some reason the completions api treats the whole thing as a single file avoiding the issue. Also, I don't know how to avoid the test that changed.

@armanio123
Copy link
Contributor Author

Closed in favor of #58216

@armanio123 armanio123 closed this Jul 4, 2024
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
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

Successfully merging this pull request may close these issues.

[ServerErrors][TypeScript] 5.6.0-dev.20240630
1 participant