Skip to content

Commit

Permalink
feat(language-service): more reliable embedded code formatting (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk authored Feb 20, 2024
1 parent 7646258 commit b1932f7
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 255 deletions.
4 changes: 2 additions & 2 deletions packages/language-core/lib/fileRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createFileRegistry(languagePlugins: LanguagePlugin[], caseSensit

return {
languagePlugins,
set(id: string, languageId: string, snapshot: ts.IScriptSnapshot): SourceFile {
set(id: string, languageId: string, snapshot: ts.IScriptSnapshot, plugins = languagePlugins): SourceFile {

const value = sourceFiles.get(id);
if (value) {
Expand Down Expand Up @@ -45,7 +45,7 @@ export function createFileRegistry(languagePlugins: LanguagePlugin[], caseSensit
const sourceFile: SourceFile = { id, languageId, snapshot };
sourceFiles.set(id, sourceFile);

for (const languagePlugin of languagePlugins) {
for (const languagePlugin of plugins) {
const virtualCode = languagePlugin.createVirtualCode(id, languageId, snapshot, this);
if (virtualCode) {
sourceFile.generated = {
Expand Down
Loading

0 comments on commit b1932f7

Please sign in to comment.