Skip to content

Commit

Permalink
refactor: move languageplugins to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
so1ve authored Jun 22, 2024
1 parent 8071923 commit 24a2cea
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type ts from 'typescript'
const vue = require('@vue/language-core')
const { removeEmitGlobalTypes } = require('vue-tsc')

const windowsPathReg = /\\/g

// #region copied from https://github.com/vuejs/language-tools/blob/0781998a29f176ad52c30d3139d5c78a5688bd5d/packages/tsc/index.ts
exports.getLanguagePlugins = (ts, options) => {
exports.getLanguagePlugins = (
ts: typeof import('typescript'),
options: ts.CreateProgramOptions,
) => {
const { configFilePath } = options.options
const vueOptions =
typeof configFilePath === 'string'
Expand All @@ -15,7 +19,7 @@ exports.getLanguagePlugins = (ts, options) => {
options.host.writeFile = (fileName, contents, ...args) => {
return writeFile(fileName, removeEmitGlobalTypes(contents), ...args)
}
const vueLanguagePlugin = vue.createVueLanguagePlugin(
const vueLanguagePlugin = vue.createVueLanguagePlugin<string>(
ts,
(id) => id,
() => '',
Expand Down

0 comments on commit 24a2cea

Please sign in to comment.