Skip to content

Commit

Permalink
monaco-editor-core -> monaco-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 16, 2023
1 parent abbc04d commit db27e23
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 56 deletions.
35 changes: 1 addition & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"conventional-changelog-cli": "^3.0.0",
"fflate": "^0.7.3",
"hash-sum": "^2.0.0",
"monaco-editor-core": "^0.38.0",
"monaco-editor": "^0.39.0",
"monaco-editor-textmate": "^4.0.0",
"monaco-textmate": "^3.0.1",
"monaco-volar": "^0.2.0",
Expand All @@ -73,38 +73,5 @@
"volar-service-typescript": "0.0.7",
"vue": "^3.3.4",
"vue-tsc": "1.7.13"
},
"peerDependencies": {
"@volar/monaco": "1.7.5",
"@vue/language-service": "1.7.13",
"monaco-editor-core": "^0.38.0",
"monaco-editor-textmate": "^4.0.0",
"monaco-textmate": "^3.0.1",
"monaco-volar": "^0.2.0",
"onigasm": "^2.2.5",
"vue": "^3.3.0"
},
"peerDependenciesMeta": {
"@volar/monaco": {
"optional": true
},
"@vue/language-service": {
"optional": true
},
"monaco-editor-core": {
"optional": true
},
"monaco-editor-textmate": {
"optional": true
},
"monaco-textmate": {
"optional": true
},
"monaco-volar": {
"optional": true
},
"onigasm": {
"optional": true
}
}
}
23 changes: 9 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/monaco/Monaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
watch,
computed
} from 'vue'
import * as monaco from 'monaco-editor-core'
import * as monaco from 'monaco-editor'
import { getOrCreateModel } from './utils'
import { loadGrammars, loadTheme } from 'monaco-volar'
import { Store } from '../store'
Expand Down
7 changes: 4 additions & 3 deletions src/monaco/env.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import editorWorker from 'monaco-editor-core/esm/vs/editor/editor.worker?worker';
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import vueWorker from './vue.worker?worker';
import * as onigasm from "onigasm";
import onigasmWasm from "onigasm/lib/onigasm.wasm?url";
import { editor, languages, Uri } from 'monaco-editor-core';
import { editor, languages, Uri } from 'monaco-editor';
import * as volar from '@volar/monaco';
import { Store } from '../store';
import { createJsDelivrDtsHost } from 'volar-service-typescript';
Expand All @@ -24,6 +24,7 @@ export function loadMonacoEnv(store: Store) {
languages.register({ id: 'vue', extensions: ['.vue'] })
languages.register({ id: 'javascript', extensions: ['.js'] })
languages.register({ id: 'typescript', extensions: ['.ts'] })
languages.register({ id: 'css', extensions: ['.css'] })
languages.onLanguage('vue', async () => {
const worker = editor.createWebWorker<any>({
moduleId: 'vs/language/vue/vueWorker',
Expand All @@ -42,7 +43,7 @@ export function loadMonacoEnv(store: Store) {
getOrCreateModel(Uri.file(filename), undefined, text);
}),
});
const languageId = ['vue', 'javascript', 'typescript'];
const languageId = ['vue', 'javascript', 'typescript', 'css'];
const getSyncUris = () => Object.keys(store.state.files).map(filename => Uri.parse(`file:///${filename}`));
volar.editor.activateMarkers(worker, languageId, 'vue', getSyncUris, editor);
volar.editor.activateAutoInsertion(worker, languageId, getSyncUris, editor);
Expand Down
2 changes: 1 addition & 1 deletion src/monaco/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Uri, editor } from 'monaco-editor-core';
import { Uri, editor } from 'monaco-editor';

export function getOrCreateModel(uri: Uri, lang: string | undefined, value: string) {
const model = editor.getModel(uri);
Expand Down
4 changes: 2 additions & 2 deletions src/monaco/vue.worker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-ignore
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker';
import type * as monaco from 'monaco-editor-core';
import * as worker from 'monaco-editor/esm/vs/editor/editor.worker';
import type * as monaco from 'monaco-editor';
import * as ts from 'typescript';
import { Config, resolveConfig } from '@vue/language-service';
import { createLanguageService } from '@volar/monaco/worker';
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default defineConfig({
'onigasm',
'typescript',
'@vue/language-service',
'monaco-editor-core/esm/vs/editor/editor.worker',
'monaco-editor/esm/vs/editor/editor.worker',
'@volar/monaco/worker',
'vue/server-renderer'
]
Expand Down

0 comments on commit db27e23

Please sign in to comment.