From 80ee161009c7c58b113270f0723163613adc01ef Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Wed, 6 Sep 2023 10:11:57 +0800 Subject: [PATCH 1/9] chore: format --- packages/vue-language-core/src/types.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/vue-language-core/src/types.ts b/packages/vue-language-core/src/types.ts index ad96941063..c89679c982 100644 --- a/packages/vue-language-core/src/types.ts +++ b/packages/vue-language-core/src/types.ts @@ -1,8 +1,7 @@ -import type { SFCParseResult } from '@vue/compiler-sfc'; - import type * as CompilerDOM from '@vue/compiler-dom'; +import type { SFCParseResult } from '@vue/compiler-sfc'; import type * as ts from 'typescript/lib/tsserverlibrary'; -import { VueEmbeddedFile } from './sourceFile'; +import type { VueEmbeddedFile } from './sourceFile'; export type { SFCParseResult } from '@vue/compiler-sfc'; @@ -23,11 +22,11 @@ export interface VueCompilerOptions { htmlAttributes: string[]; optionsWrapper: [string, string] | []; macros: { - defineProps: string[], - defineSlots: string[], - defineEmits: string[], - defineExpose: string[], - withDefaults: string[], + defineProps: string[]; + defineSlots: string[]; + defineEmits: string[]; + defineExpose: string[]; + withDefaults: string[]; }; plugins: VueLanguagePlugin[]; hooks: string[]; @@ -107,6 +106,6 @@ export interface Sfc { } export interface TextRange { - start: number, - end: number, + start: number; + end: number; } From 929d833e2967480978d77034865a13f64fdfe6e0 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Wed, 6 Sep 2023 10:22:59 +0800 Subject: [PATCH 2/9] feat: Add Portuguese language (#3535) --- .../data/language-blocks/en.json | 68 ++ .../data/language-blocks/fr.json | 68 ++ .../data/language-blocks/ja.json | 68 ++ .../data/language-blocks/ko.json | 68 ++ .../data/language-blocks/pt.json | 694 +++++++++++++ .../data/language-blocks/zh-cn.json | 68 ++ .../data/model-modifiers/en.json | 12 + .../data/model-modifiers/fr.json | 12 + .../data/model-modifiers/ja.json | 12 + .../data/model-modifiers/ko.json | 12 + .../data/model-modifiers/pt.json | 116 +++ .../data/model-modifiers/zh-cn.json | 12 + .../data/template/en.json | 104 ++ .../data/template/fr.json | 104 ++ .../data/template/ja.json | 104 ++ .../data/template/ko.json | 104 ++ .../data/template/pt.json | 978 ++++++++++++++++++ .../data/template/zh-cn.json | 104 ++ .../scripts/update-html-data.js | 6 + .../vue-language-service/src/plugins/data.ts | 9 + 20 files changed, 2723 insertions(+) create mode 100644 packages/vue-language-service/data/language-blocks/pt.json create mode 100644 packages/vue-language-service/data/model-modifiers/pt.json create mode 100644 packages/vue-language-service/data/template/pt.json diff --git a/packages/vue-language-service/data/language-blocks/en.json b/packages/vue-language-service/data/language-blocks/en.json index 53e4f1dee0..ae0e0316af 100644 --- a/packages/vue-language-service/data/language-blocks/en.json +++ b/packages/vue-language-service/data/language-blocks/en.json @@ -34,6 +34,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -75,6 +79,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] } @@ -107,6 +115,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#template" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#template" } ] }, @@ -143,6 +155,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -190,6 +206,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -227,6 +247,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] } @@ -259,6 +283,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script" } ] }, @@ -293,6 +321,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] }, @@ -329,6 +361,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -382,6 +418,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -416,6 +456,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#scoped-css" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#scoped-css" } ] }, @@ -450,6 +494,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#css-modules" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#css-modules" } ] } @@ -482,6 +530,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#style" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#style" } ] }, @@ -518,6 +570,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } @@ -550,6 +606,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#custom-blocks" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#custom-blocks" } ] } @@ -586,6 +646,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -619,6 +683,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } diff --git a/packages/vue-language-service/data/language-blocks/fr.json b/packages/vue-language-service/data/language-blocks/fr.json index 975be66577..92a6081c19 100644 --- a/packages/vue-language-service/data/language-blocks/fr.json +++ b/packages/vue-language-service/data/language-blocks/fr.json @@ -34,6 +34,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -75,6 +79,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] } @@ -107,6 +115,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#template" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#template" } ] }, @@ -143,6 +155,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -190,6 +206,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -227,6 +247,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] } @@ -259,6 +283,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script" } ] }, @@ -293,6 +321,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] }, @@ -329,6 +361,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -382,6 +418,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -416,6 +456,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#scoped-css" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#scoped-css" } ] }, @@ -450,6 +494,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#css-modules" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#css-modules" } ] } @@ -482,6 +530,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#style" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#style" } ] }, @@ -518,6 +570,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } @@ -550,6 +606,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#blocs-personnalisés" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#blocs-personnalisés" } ] } @@ -586,6 +646,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -619,6 +683,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } diff --git a/packages/vue-language-service/data/language-blocks/ja.json b/packages/vue-language-service/data/language-blocks/ja.json index cc993c6c29..c1acc4cd39 100644 --- a/packages/vue-language-service/data/language-blocks/ja.json +++ b/packages/vue-language-service/data/language-blocks/ja.json @@ -34,6 +34,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -75,6 +79,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] } @@ -107,6 +115,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#template" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#template" } ] }, @@ -143,6 +155,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -190,6 +206,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -227,6 +247,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] } @@ -259,6 +283,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script" } ] }, @@ -293,6 +321,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] }, @@ -329,6 +361,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -382,6 +418,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -416,6 +456,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#scoped-css" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#scoped-css" } ] }, @@ -450,6 +494,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#css-modules" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#css-modules" } ] } @@ -482,6 +530,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#style" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#style" } ] }, @@ -518,6 +570,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } @@ -550,6 +606,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#カスタムブロック" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#カスタムブロック" } ] } @@ -586,6 +646,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -619,6 +683,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } diff --git a/packages/vue-language-service/data/language-blocks/ko.json b/packages/vue-language-service/data/language-blocks/ko.json index 2e23e11494..b63ce36bc1 100644 --- a/packages/vue-language-service/data/language-blocks/ko.json +++ b/packages/vue-language-service/data/language-blocks/ko.json @@ -34,6 +34,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -75,6 +79,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] } @@ -107,6 +115,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#template" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#template" } ] }, @@ -143,6 +155,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -190,6 +206,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -227,6 +247,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] } @@ -259,6 +283,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script" } ] }, @@ -293,6 +321,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#script-setup" } ] }, @@ -329,6 +361,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] }, @@ -382,6 +418,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -416,6 +456,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#scoped-css" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#scoped-css" } ] }, @@ -450,6 +494,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-css-features.html#css-modules" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-css-features.html#css-modules" } ] } @@ -482,6 +530,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#style" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#style" } ] }, @@ -518,6 +570,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } @@ -550,6 +606,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#커스텀-블럭" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#커스텀-블럭" } ] } @@ -586,6 +646,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" } ] }, @@ -619,6 +683,10 @@ { "name": "ko", "url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#src-imports" } ] } diff --git a/packages/vue-language-service/data/language-blocks/pt.json b/packages/vue-language-service/data/language-blocks/pt.json new file mode 100644 index 0000000000..879dd7ebee --- /dev/null +++ b/packages/vue-language-service/data/language-blocks/pt.json @@ -0,0 +1,694 @@ +{ + "version": 1.1, + "tags": [ + { + "name": "template", + "attributes": [ + { + "name": "src", + "description": { + "kind": "markdown", + "value": "\nSe você prefere dividir seu componente `*.vue` em multiplos arquivos, você pode usar o atributo `src` para importar um arquivo externo para o bloco de linguagem:\n\n```vue\n\n\n\n```\n\nEsteja ciente de que as importações `src` seguem as mesmas regras de resolução de caminho que as solicitações do módulo webpack, o que significa:\n\n- Caminhos relativos precisam começar com `./`\n- Você pode importar recursos de dependências do npm:\n\n```vue\n\n\n```\n\nNote que a integração com vários pré-processadores pode diferir por conjunto de ferramentas. Confira a respectiva documentação para exemplos:\n\n- [Vite](https://vitejs.dev/guide/features.html#css-pre-processors)\n- [Vue CLI](https://cli.vuejs.org/guide/css.html#pre-processors)\n- [webpack + vue-loader](https://vue-loader.vuejs.org/guide/pre-processors.html#using-pre-processors)\n" + }, + "values": [ + { + "name": "html" + }, + { + "name": "pug" + } + ], + "references": [ + { + "name": "en", + "url": "https://vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "zh-cn", + "url": "https://cn.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "ja", + "url": "https://ja.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "ua", + "url": "https://ua.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "fr", + "url": "https://fr.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "ko", + "url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors" + }, + { + "name": "pt", + "url": "https://pt.vuejs.org/api/sfc-spec.html#pre-processors" + } + ] + } + ], + "description": { + "kind": "markdown", + "value": "\n- Cada arquivo `*.vue` pode conter no máximo um bloco `