Skip to content

Commit 9cd04ec

Browse files
committed
feat: delete plugin ordering hack
Vue Official made patching plugin order on their side. See issue - vuejs/language-tools#5483, discord thread - https://discord.com/channels/325477692906536972/1391386265986793564
1 parent 4b0f271 commit 9cd04ec

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

src/extension.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -141,43 +141,4 @@ export const activate = async () => {
141141
disposables,
142142
)
143143
}
144-
}
145-
146-
try {
147-
const tsExtension = vscode.extensions.getExtension('vscode.typescript-language-features')!
148-
const readFileSyncUnpatched = require('fs').readFileSync
149-
150-
const extensionJsPath = require.resolve('./dist/extension.js', {
151-
paths: [tsExtension.extensionPath],
152-
})
153-
154-
require('fs').readFileSync = (...args) => {
155-
if (args[0] === extensionJsPath) {
156-
let text = readFileSyncUnpatched(...args) as string
157-
158-
// sort plugins
159-
text = text.replace(
160-
'"--globalPlugins",i.plugins',
161-
'"--globalPlugins",i.plugins.sort((a,b)=>(b.name==="typescript-essential-plugins"?1:0)-(a.name==="typescript-essential-plugins"?1:0))',
162-
)
163-
164-
return text
165-
}
166-
167-
return readFileSyncUnpatched(...args)
168-
}
169-
170-
const loadedModule = require.cache[extensionJsPath]
171-
if (loadedModule) {
172-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
173-
delete require.cache[extensionJsPath]
174-
const patchedModule = require(extensionJsPath)
175-
Object.assign(loadedModule.exports, patchedModule)
176-
}
177-
178-
if (tsExtension.isActive) {
179-
void vscode.commands.executeCommand('workbench.action.restartExtensionHost')
180-
}
181-
} catch (e) {
182-
console.error('Error patching TS extension', e)
183-
}
144+
}

0 commit comments

Comments
 (0)