Skip to content

Commit

Permalink
fix(vscode): duplicate ts version status
Browse files Browse the repository at this point in the history
refs #4167
  • Loading branch information
johnsoncodehk committed Mar 28, 2024
1 parent 5bc819d commit f7fb0f9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions extensions/vscode/src/nodeClientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,6 @@ try {
// @ts-expect-error
let text = readFileSync(...args) as string;

// VSCode < 1.87.0
text = text.replace('t.$u=[t.$r,t.$s,t.$p,t.$q]', s => s + '.concat("vue")'); // patch jsTsLanguageModes
text = text.replace('.languages.match([t.$p,t.$q,t.$r,t.$s]', s => s + '.concat("vue")'); // patch isSupportedLanguageMode

// VSCode >= 1.87.0
text = text.replace('t.jsTsLanguageModes=[t.javascript,t.javascriptreact,t.typescript,t.typescriptreact]', s => s + '.concat("vue")'); // patch jsTsLanguageModes
text = text.replace('.languages.match([t.typescript,t.typescriptreact,t.javascript,t.javascriptreact]', s => s + '.concat("vue")'); // patch isSupportedLanguageMode

if (!hybridMode) {
// patch readPlugins
text = text.replace(
Expand All @@ -160,6 +152,15 @@ try {
].join(''),
);
}
else {
// VSCode < 1.87.0
text = text.replace('t.$u=[t.$r,t.$s,t.$p,t.$q]', s => s + '.concat("vue")'); // patch jsTsLanguageModes
text = text.replace('.languages.match([t.$p,t.$q,t.$r,t.$s]', s => s + '.concat("vue")'); // patch isSupportedLanguageMode

// VSCode >= 1.87.0
text = text.replace('t.jsTsLanguageModes=[t.javascript,t.javascriptreact,t.typescript,t.typescriptreact]', s => s + '.concat("vue")'); // patch jsTsLanguageModes
text = text.replace('.languages.match([t.typescript,t.typescriptreact,t.javascript,t.javascriptreact]', s => s + '.concat("vue")'); // patch isSupportedLanguageMode
}

return text;
}
Expand Down

0 comments on commit f7fb0f9

Please sign in to comment.