Skip to content

Commit

Permalink
feat: support custom file go to difinition (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
zqran authored Jun 22, 2023
1 parent a1a3fe1 commit 48e1e0f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/monaco/Monaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ onMounted(async () => {
})
editor.value = editorInstance
// Support for go to definition
monaco.editor.registerEditorOpener({
openCodeEditor(_, resource) {
const path = resource.path
if (/^\//.test(path) && !/^\/node_modules/.test(path)) {
const fileName = path.replace('/', '')
if (fileName !== store.state.activeFile.filename) {
store.setActive(fileName)
return true
}
}
return false
}
})
// Support for semantic highlighting
const t = (editorInstance as any)._themeService._theme
t.getTokenStyleMetadata = (
Expand Down

0 comments on commit 48e1e0f

Please sign in to comment.