Skip to content

Conversation

@asgerf
Copy link
Contributor

@asgerf asgerf commented Jan 21, 2025

When TypeScript code is embedded in a HTML-like file such as a Vue file, we write the embedded code to a separate .ts file, to be extracted later by the TypeScript extractor. (To avoid starting up the TypeScript extractor in a multi-threaded context). These generated files are called "snippets". The mapping between such snippet files and their original source location is stored in ExtractorState#getSnippets().

We have two different code paths for scheduling TypeScript files for extraction: one for files that are part of a tsconfig file, and one for "loose" files that aren't associated with any tsconfig. The second code path however was missing a case for extracting snippets. This led to unextracted code and DB consistency errors. This PR adds the missing snippet-extracting code.

@github-actions github-actions bot added the JS label Jan 21, 2025
@asgerf asgerf marked this pull request as ready for review January 21, 2025 13:44
Copilot AI review requested due to automatic review settings January 21, 2025 13:44
@asgerf asgerf requested a review from a team as a code owner January 21, 2025 13:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • javascript/ql/test/library-tests/TypeScript/RegressionTests/EmbeddedTypeScriptNoTSConfig/test.expected: Language not supported
  • javascript/ql/test/library-tests/TypeScript/RegressionTests/EmbeddedTypeScriptNoTSConfig/test.ql: Language not supported
Comments suppressed due to low confidence (1)

javascript/extractor/src/com/semmle/js/extractor/Main.java:183

  • Ensure that the new behavior of adding TypeScript snippets to remainingTypescriptFiles is covered by tests.
for (Map.Entry<Path, FileSnippet> entry : extractorState.getSnippets().entrySet()) {

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@asgerf
Copy link
Contributor Author

asgerf commented Jan 22, 2025

Evaluation looks quiet

@asgerf asgerf merged commit f845ac1 into github:main Jan 22, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants