add vue language support

This commit is contained in:
JongwooLee 2024-07-07 23:25:18 +09:00 committed by Jonatan Heyman
parent 0aaf62925f
commit f9c841d19e
4 changed files with 28 additions and 5 deletions

21
package-lock.json generated
View File

@ -25,6 +25,7 @@
"@codemirror/lang-python": "^6.1.3",
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/lang-sql": "^6.5.4",
"@codemirror/lang-vue": "^0.1.3",
"@codemirror/lang-xml": "^6.0.2",
"@codemirror/language": "^6.9.3",
"@codemirror/legacy-modes": "^6.3.3",
@ -427,6 +428,20 @@
"@lezer/lr": "^1.0.0"
}
},
"node_modules/@codemirror/lang-vue": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@codemirror/lang-vue/-/lang-vue-0.1.3.tgz",
"integrity": "sha512-QSKdtYTDRhEHCfo5zOShzxCmqKJvgGrZwDQSdbvCRJ5pRLWBS7pD/8e/tH44aVQT6FKm0t6RVNoSUWHOI5vNug==",
"dev": true,
"dependencies": {
"@codemirror/lang-html": "^6.0.0",
"@codemirror/lang-javascript": "^6.1.2",
"@codemirror/language": "^6.0.0",
"@lezer/common": "^1.2.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.3.1"
}
},
"node_modules/@codemirror/lang-xml": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@codemirror/lang-xml/-/lang-xml-6.0.2.tgz",
@ -992,9 +1007,9 @@
"dev": true
},
"node_modules/@lezer/common": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.1.2.tgz",
"integrity": "sha512-V+GqBsga5+cQJMfM0GdnHmg4DgWvLzgMWjbldBg0+jC3k9Gu6nJNZDLJxXEBT1Xj8KhRN4jmbC5CY7SIL++sVw==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz",
"integrity": "sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==",
"dev": true
},
"node_modules/@lezer/cpp": {

View File

@ -44,6 +44,7 @@
"@codemirror/lang-python": "^6.1.3",
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/lang-sql": "^6.5.4",
"@codemirror/lang-vue": "^0.1.3",
"@codemirror/lang-xml": "^6.0.2",
"@codemirror/language": "^6.9.3",
"@codemirror/legacy-modes": "^6.3.3",

View File

@ -1,6 +1,6 @@
importScripts("guesslang.min.js")
GUESSLANG_LANGUAGES = ["json","py","html","sql","md","java","php","css","xml","cpp","rs","cs","rb","sh","yaml","toml","go","clj","erl","js","ts","swift","kt","groovy","ps1"]
GUESSLANG_LANGUAGES = ["json","py","html","sql","md","java","php","css","xml","cpp","rs","cs","rb","sh","yaml","toml","go","clj","erl","js","ts","swift","kt","groovy","ps1","vue"]
const guessLang = new self.GuessLang()

View File

@ -12,6 +12,7 @@ import { cppLanguage } from "@codemirror/lang-cpp"
import { xmlLanguage } from "@codemirror/lang-xml"
import { rustLanguage } from "@codemirror/lang-rust"
import { csharpLanguage } from "@replit/codemirror-lang-csharp"
import { vueLanguage } from "@codemirror/lang-vue";
import { StreamLanguage } from "@codemirror/language"
import { ruby } from "@codemirror/legacy-modes/mode/ruby"
@ -40,7 +41,7 @@ class Language {
/**
* @param token: The token used to identify the language in the buffer content
* @param name: The name of the language
* @param parser: The Lezer parser used to parse the language
* @param parser: The Lezer parser used to parse the language
* @param guesslang: The name of the language as used by the guesslang library
* @param prettier: The prettier configuration for the language (if any)
*/
@ -253,6 +254,12 @@ export const LANGUAGES = [
parser: StreamLanguage.define(powerShell).parser,
guesslang: "ps1",
}),
new Language({
token: "vue",
name: "Vue",
parser: vueLanguage.parser,
guesslang: "vue",
}),
]