├── .editorconfig
├── .gitattributes
├── .github
├── CONTRIBUTING.md
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── NO_REPRO_CASE.md
├── PERF_ISSUE.md
├── PULL_REQUEST_TEMPLATE.md
├── dependabot.yml
└── workflows
│ ├── ci.yml
│ └── rebase.yml
├── .gitignore
├── .husky
├── .gitignore
└── pre-commit
├── .prettierignore
├── .prettierrc
├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── ThirdPartyNotices.txt
├── asset
├── stepsize.png
└── vue.png
├── build
├── release-cleanup.sh
├── rollup-common-config.js
├── rollup-plugins.js
├── update-docs.sh
└── vsix-links.js
├── client
├── client.ts
├── commands
│ ├── doctorCommand.ts
│ ├── generateGrammarCommand.ts
│ ├── openUserScaffoldSnippetFolderCommand.ts
│ └── virtualFileCommand.ts
├── grammar.ts
├── languages.ts
├── rollup.config.js
├── tsconfig.json
├── userSnippetDir.ts
└── vueMain.ts
├── docs
├── .vuepress
│ └── config.js
├── README.md
├── credits.md
├── guide
│ ├── FAQ.md
│ ├── Readme.md
│ ├── component-data.md
│ ├── debugging.md
│ ├── emmet.md
│ ├── formatting.md
│ ├── global-components.md
│ ├── highlighting.md
│ ├── intellisense.md
│ ├── interpolation.md
│ ├── linting-error.md
│ ├── semantic-highlighting.md
│ ├── setup.md
│ ├── snippet.md
│ └── vti.md
├── images
│ ├── debug.png
│ ├── scope.png
│ ├── snippet-main.png
│ └── snippet-partial.png
└── reference
│ ├── Readme.md
│ ├── package.md
│ └── tsconfig.md
├── languages
├── vue-html-language-configuration.json
├── vue-language-configuration.json
├── vue-postcss-language-configuration.json
├── vue-pug-language-configuration.json
└── vue-sugarss-language-configuration.json
├── package.json
├── rfcs
├── 001-vetur-config-file.md
└── 002-monorepo-support.md
├── rollup.config.js
├── scripts
├── build_grammar.ts
└── tsconfig.json
├── server
├── .gitignore
├── .mocharc.yml
├── .npmrc
├── README.md
├── bin
│ └── vls
├── package.json
├── rollup.config.js
├── src
│ ├── config.ts
│ ├── embeddedSupport
│ │ ├── embeddedSupport.ts
│ │ ├── languageModelCache.ts
│ │ ├── languageModes.ts
│ │ ├── test
│ │ │ └── embeddedSupport.test.ts
│ │ └── vueDocumentRegionParser.ts
│ ├── index.ts
│ ├── log.ts
│ ├── modes
│ │ ├── nullMode.ts
│ │ ├── plugins
│ │ │ └── autoImportSfcPlugin.ts
│ │ ├── pug
│ │ │ ├── index.ts
│ │ │ └── languageService.ts
│ │ ├── script
│ │ │ ├── CodeActionKindConverter.ts
│ │ │ ├── childComponents.ts
│ │ │ ├── componentInfo.ts
│ │ │ ├── globalComponents.ts
│ │ │ ├── javascript.ts
│ │ │ ├── previewer.ts
│ │ │ └── semanticToken.ts
│ │ ├── style
│ │ │ ├── emmet.ts
│ │ │ ├── index.ts
│ │ │ ├── sass
│ │ │ │ └── sassLanguageMode.ts
│ │ │ └── stylus
│ │ │ │ ├── built-in.ts
│ │ │ │ ├── completion-item.ts
│ │ │ │ ├── css-browser-data.ts
│ │ │ │ ├── css-colors-list.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── parser.ts
│ │ │ │ ├── stylus-hover.ts
│ │ │ │ ├── stylus-supremacy.ts
│ │ │ │ ├── symbols-finder.ts
│ │ │ │ └── test
│ │ │ │ ├── completion.test.ts
│ │ │ │ └── hover.test.ts
│ │ ├── template-common
│ │ │ └── tagDefinition.ts
│ │ ├── template
│ │ │ ├── htmlMode.ts
│ │ │ ├── index.ts
│ │ │ ├── interpolationMode.ts
│ │ │ ├── modifierProvider.ts
│ │ │ ├── parser
│ │ │ │ ├── htmlParser.ts
│ │ │ │ └── htmlScanner.ts
│ │ │ ├── services
│ │ │ │ ├── htmlCompletion.ts
│ │ │ │ ├── htmlDefinition.ts
│ │ │ │ ├── htmlEslintValidation.ts
│ │ │ │ ├── htmlFolding.ts
│ │ │ │ ├── htmlFormat.ts
│ │ │ │ ├── htmlHighlighting.ts
│ │ │ │ ├── htmlHover.ts
│ │ │ │ ├── htmlLinks.ts
│ │ │ │ ├── htmlSymbolsProvider.ts
│ │ │ │ ├── isInsideInterpolation.ts
│ │ │ │ └── vuePropValidation.ts
│ │ │ ├── tagProviders
│ │ │ │ ├── common.ts
│ │ │ │ ├── componentInfoTagProvider.ts
│ │ │ │ ├── externalTagProviders.ts
│ │ │ │ ├── htmlTags.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── nuxtTags.ts
│ │ │ │ ├── routerTags.ts
│ │ │ │ └── vueTags.ts
│ │ │ └── test
│ │ │ │ ├── completion.test.ts
│ │ │ │ ├── emmet.test.ts
│ │ │ │ ├── highlighting.test.ts
│ │ │ │ ├── hover.test.ts
│ │ │ │ ├── isInsideInterpolation.test.ts
│ │ │ │ ├── links.test.ts
│ │ │ │ ├── parser.test.ts
│ │ │ │ ├── scanner.test.ts
│ │ │ │ └── symbols.test.ts
│ │ ├── test-util
│ │ │ ├── completion-test-util.ts
│ │ │ └── hover-test-util.ts
│ │ ├── test
│ │ │ └── region.test.ts
│ │ └── vue
│ │ │ ├── index.ts
│ │ │ ├── snippets.ts
│ │ │ └── veturSnippets
│ │ │ ├── default.vue
│ │ │ ├── script
│ │ │ ├── composition-js-vue2.vue
│ │ │ ├── composition-js.vue
│ │ │ ├── composition-ts-vue2.vue
│ │ │ ├── composition-ts.vue
│ │ │ ├── javascript.vue
│ │ │ └── typescript.vue
│ │ │ ├── style
│ │ │ ├── css-scoped.vue
│ │ │ ├── css.vue
│ │ │ ├── less-scoped.vue
│ │ │ ├── less.vue
│ │ │ ├── postcss-scoped.vue
│ │ │ ├── postcss.vue
│ │ │ ├── sass-scoped.vue
│ │ │ ├── sass.vue
│ │ │ ├── scss-scoped.vue
│ │ │ ├── scss.vue
│ │ │ ├── sss-scoped.vue
│ │ │ ├── sss.vue
│ │ │ ├── stylus-scoped.vue
│ │ │ └── stylus.vue
│ │ │ └── template
│ │ │ ├── html.vue
│ │ │ └── pug.vue
│ ├── prettierEslint.d.ts
│ ├── prettierTslint.d.ts
│ ├── services
│ │ ├── EnvironmentService.ts
│ │ ├── RefTokenService.ts
│ │ ├── dependencyService.ts
│ │ ├── documentService.ts
│ │ ├── projectService.ts
│ │ ├── typescriptService
│ │ │ ├── bridge.ts
│ │ │ ├── diagnosticFilter.ts
│ │ │ ├── moduleResolutionCache.ts
│ │ │ ├── preprocess.ts
│ │ │ ├── serviceHost.ts
│ │ │ ├── sourceMap.ts
│ │ │ ├── test
│ │ │ │ ├── sourceMap.test.ts
│ │ │ │ └── transformTemplate.test.ts
│ │ │ ├── transformTemplate.ts
│ │ │ ├── util.ts
│ │ │ ├── vueSys.ts
│ │ │ └── walkExpression.ts
│ │ ├── vls.ts
│ │ └── vueInfoService.ts
│ ├── types.ts
│ ├── typing.d.ts
│ ├── utils
│ │ ├── cancellationToken.ts
│ │ ├── paths.ts
│ │ ├── prettier
│ │ │ └── index.ts
│ │ ├── sleep.ts
│ │ ├── strings.ts
│ │ ├── vueVersion.ts
│ │ └── workspace.ts
│ └── vueServerMain.ts
├── tsconfig.json
├── tsconfig.test.json
└── yarn.lock
├── syntaxes
├── markdown-vue.json
├── pug
│ ├── directives.YAML
│ ├── directives.tmLanguage.json
│ ├── interpolations.YAML
│ └── interpolations.tmLanguage.json
├── vue-generated.json
├── vue-html.YAML
├── vue-html.tmLanguage.json
├── vue-postcss.json
├── vue-sugarss.json
├── vue.tmLanguage.json
└── vue.yaml
├── test
├── codeTestRunner.ts
├── completionHelper.ts
├── componentData
│ ├── data-dir
│ │ └── User
│ │ │ └── settings.json
│ ├── features
│ │ ├── beforeAll
│ │ │ └── beforeAll.test.ts
│ │ ├── completion
│ │ │ └── basic.test.ts
│ │ └── hover
│ │ │ └── basic.test.ts
│ ├── fixture
│ │ ├── .vscode
│ │ │ └── settings.json
│ │ ├── attributes.json
│ │ ├── beforeAll.vue
│ │ ├── completion
│ │ │ ├── Element.vue
│ │ │ ├── Event.vue
│ │ │ ├── Link.vue
│ │ │ ├── Quasar.vue
│ │ │ ├── VueRouter.vue
│ │ │ └── WorkspaceCustomTags.vue
│ │ ├── hover
│ │ │ └── Element.vue
│ │ ├── package.json
│ │ ├── tags.json
│ │ └── yarn.lock
│ ├── index.ts
│ └── path.ts
├── definitionHelper.ts
├── diagnosticHelper.ts
├── editorHelper.ts
├── grammar
│ ├── data-dir
│ │ └── User
│ │ │ └── settings.json
│ ├── fixture
│ │ ├── Functional.vue
│ │ ├── Html.vue
│ │ ├── Issue1465.vue
│ │ ├── PascalCase.vue
│ │ ├── Pug.vue
│ │ ├── SingleLine.vue
│ │ ├── SugarSS.vue
│ │ ├── TemplateTag.vue
│ │ └── embedded.md
│ ├── grammar.test.ts
│ ├── index.ts
│ └── results
│ │ ├── Functional_vue.json
│ │ ├── Html_vue.json
│ │ ├── Issue1465_vue.json
│ │ ├── PascalCase_vue.json
│ │ ├── Pug_vue.json
│ │ ├── SingleLine_vue.json
│ │ ├── SugarSS_vue.json
│ │ ├── TemplateTag_vue.json
│ │ └── embedded_md.json
├── hoverHelper.ts
├── interpolation
│ ├── data-dir
│ │ └── User
│ │ │ └── settings.json
│ ├── features
│ │ ├── beforeAll
│ │ │ └── beforeAll.test.ts
│ │ ├── completion
│ │ │ ├── basic.test.ts
│ │ │ ├── class.test.ts
│ │ │ └── property.test.ts
│ │ ├── definition
│ │ │ ├── basic.test.ts
│ │ │ ├── class.test.ts
│ │ │ └── pug.test.ts
│ │ ├── diagnostics
│ │ │ ├── basic.test.ts
│ │ │ ├── propTypeValidation.test.ts
│ │ │ └── propsValidation.test.ts
│ │ └── hover
│ │ │ └── basic.test.ts
│ ├── fixture
│ │ ├── .vscode
│ │ │ └── settings.json
│ │ ├── beforeAll.vue
│ │ ├── completion
│ │ │ ├── Basic.vue
│ │ │ ├── Parent.vue
│ │ │ ├── TestComp.vue
│ │ │ ├── classComponent
│ │ │ │ ├── Child.vue
│ │ │ │ └── Parent.vue
│ │ │ └── propertyDecorator
│ │ │ │ ├── Child.vue
│ │ │ │ └── Parent.vue
│ │ ├── definition
│ │ │ ├── Basic.vue
│ │ │ ├── BasicPug.vue
│ │ │ ├── Child.vue
│ │ │ ├── TestBar.vue
│ │ │ └── classComponent
│ │ │ │ ├── Child.vue
│ │ │ │ └── Parent.vue
│ │ ├── diagnostics
│ │ │ ├── class-in-template.vue
│ │ │ ├── directive-dynamic-argument.vue
│ │ │ ├── directive.vue
│ │ │ ├── expression.vue
│ │ │ ├── external-script.ts
│ │ │ ├── external-script.vue
│ │ │ ├── filter.vue
│ │ │ ├── hyphen-attrs.vue
│ │ │ ├── issue-1745-duplicate-event-with-modifiers.vue
│ │ │ ├── issue-2254.vue
│ │ │ ├── issue-2258.vue
│ │ │ ├── issue-3107.vue
│ │ │ ├── jsdocs-type-check.vue
│ │ │ ├── member-modifiers.vue
│ │ │ ├── no-implicit-any-parameters.vue
│ │ │ ├── no-implicit-any-v-for-array.vue
│ │ │ ├── object-literal.vue
│ │ │ ├── optional-in-template.vue
│ │ │ ├── propTypeValidation
│ │ │ │ ├── ArrayPropsChild.vue
│ │ │ │ ├── JSChild.vue
│ │ │ │ ├── ParentRight.vue
│ │ │ │ ├── ParentWrong.vue
│ │ │ │ └── TSChild.vue
│ │ │ ├── propsValidation
│ │ │ │ ├── array-props-child.vue
│ │ │ │ ├── class-child.vue
│ │ │ │ ├── object-validator-props-child.vue
│ │ │ │ ├── parent.vue
│ │ │ │ ├── pass-parent.vue
│ │ │ │ └── simple-validator-props-child.vue
│ │ │ ├── style-in-template.vue
│ │ │ ├── template-literal.vue
│ │ │ ├── template-position.vue
│ │ │ ├── trivia.vue
│ │ │ ├── v-for.vue
│ │ │ ├── v-if-and-v-for.vue
│ │ │ ├── v-if-narrowing.vue
│ │ │ ├── v-on.vue
│ │ │ ├── v-slot-scope.vue
│ │ │ └── v-slot.vue
│ │ ├── hover
│ │ │ └── Basic.vue
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │ └── yarn.lock
│ ├── index.ts
│ └── path.ts
├── lsp
│ ├── data-dir
│ │ └── User
│ │ │ └── settings.json
│ ├── features
│ │ ├── beforeAll
│ │ │ └── beforeAll.test.ts
│ │ ├── codeAction
│ │ │ └── basic.test.ts
│ │ ├── completion
│ │ │ ├── autoImport.test.ts
│ │ │ ├── emmet.test.ts
│ │ │ ├── pathCompletion.test.ts
│ │ │ ├── scaffold.test.ts
│ │ │ ├── script.test.ts
│ │ │ ├── style.test.ts
│ │ │ └── template.test.ts
│ │ ├── definition
│ │ │ └── basic.test.ts
│ │ ├── diagnostics
│ │ │ ├── Deprecated.test.ts
│ │ │ ├── basic.test.ts
│ │ │ ├── dotPrefix.test.ts
│ │ │ ├── eslint.test.ts
│ │ │ ├── issue-1336.test.ts
│ │ │ ├── noScriptRegion.test.ts
│ │ │ └── unused.test.ts
│ │ ├── documentColor
│ │ │ └── basic.test.ts
│ │ ├── documentHighlight
│ │ │ └── basic.test.ts
│ │ ├── documentLink
│ │ │ └── basic.test.ts
│ │ ├── documentSymbol
│ │ │ └── basic.test.ts
│ │ ├── external
│ │ │ └── basic.test.ts
│ │ ├── formatting
│ │ │ └── basic.test.ts
│ │ ├── hover
│ │ │ └── basic.test.ts
│ │ ├── references
│ │ │ └── basic.test.ts
│ │ ├── renameFiles
│ │ │ └── basic.test.ts
│ │ └── semanticTokens
│ │ │ └── basic.test.ts
│ ├── fixture
│ │ ├── .gitignore
│ │ ├── .prettierrc
│ │ ├── .vscode
│ │ │ ├── settings.json
│ │ │ └── vetur
│ │ │ │ └── snippets
│ │ │ │ └── foo.vue
│ │ ├── beforeAll.vue
│ │ ├── codeAction
│ │ │ └── Basic.vue
│ │ ├── completion
│ │ │ ├── autoImport
│ │ │ │ ├── defineInOneLine.vue
│ │ │ │ ├── kebab-case.vue
│ │ │ │ ├── noDefineComponents.vue
│ │ │ │ └── sameComponentName.vue
│ │ │ ├── script
│ │ │ │ ├── Basic.vue
│ │ │ │ ├── Hyphen.vue
│ │ │ │ ├── Item.vue
│ │ │ │ ├── PathCompletion.vue
│ │ │ │ ├── issue-2300.vue
│ │ │ │ └── kindModifiers.vue
│ │ │ ├── style
│ │ │ │ ├── Basic.vue
│ │ │ │ ├── Double.vue
│ │ │ │ └── SassEmmet.vue
│ │ │ ├── template
│ │ │ │ ├── Basic.vue
│ │ │ │ ├── Emmet.vue
│ │ │ │ ├── Item.vue
│ │ │ │ └── childComponent
│ │ │ │ │ ├── Child1775.vue
│ │ │ │ │ ├── Child2143.vue
│ │ │ │ │ ├── ChildComp.vue
│ │ │ │ │ ├── Parent.vue
│ │ │ │ │ ├── Parent1775.vue
│ │ │ │ │ └── Parent2143.vue
│ │ │ └── vue
│ │ │ │ ├── Custom.vue
│ │ │ │ └── Scaffold.vue
│ │ ├── components
│ │ │ ├── App.vue
│ │ │ ├── Counter.vue
│ │ │ └── Item.vue
│ │ ├── definition
│ │ │ ├── Basic.Item.vue
│ │ │ └── Basic.vue
│ │ ├── diagnostics
│ │ │ ├── .vitepress
│ │ │ │ └── Basic.vue
│ │ │ ├── Basic.vue
│ │ │ ├── Deprecated.vue
│ │ │ ├── ESLint.vue
│ │ │ ├── Unused.vue
│ │ │ ├── issue-1336.vue
│ │ │ └── noScriptRegion
│ │ │ │ ├── ChildComp.vue
│ │ │ │ └── ParentComp.vue
│ │ ├── documentColor
│ │ │ └── Basic.vue
│ │ ├── documentHighlight
│ │ │ ├── Basic.Item.vue
│ │ │ └── Basic.vue
│ │ ├── documentLink
│ │ │ └── Basic.vue
│ │ ├── documentSymbol
│ │ │ └── Basic.vue
│ │ ├── external
│ │ │ ├── Foo.pug
│ │ │ ├── Foo.ts
│ │ │ └── Foo.vue
│ │ ├── formatting
│ │ │ ├── Basic.Expected.vue
│ │ │ ├── Basic.vue
│ │ │ ├── Pug.Expected.vue
│ │ │ ├── Pug.vue
│ │ │ ├── Sass.Expected.vue
│ │ │ ├── Sass.vue
│ │ │ ├── TwoStylus.Expected.vue
│ │ │ ├── TwoStylus.vue
│ │ │ ├── VueHNUserView.Expected.vue
│ │ │ ├── VueHNUserView.vue
│ │ │ ├── issue-2467.Expected.vue
│ │ │ └── issue-2467.vue
│ │ ├── hover
│ │ │ └── Basic.vue
│ │ ├── package.json
│ │ ├── references
│ │ │ ├── Basic.Item.vue
│ │ │ └── Basic.vue
│ │ ├── renameFiles
│ │ │ ├── Basic.vue
│ │ │ └── Imported.vue
│ │ ├── router.js
│ │ ├── semanticTokens
│ │ │ └── Basic.vue
│ │ ├── store.js
│ │ ├── tsconfig.json
│ │ └── yarn.lock
│ ├── index.ts
│ └── path.ts
├── monorepo
│ ├── data-dir
│ │ └── User
│ │ │ └── settings.json
│ ├── features
│ │ ├── beforeAll
│ │ │ └── beforeAll.test.ts
│ │ ├── completion
│ │ │ ├── alias.test.ts
│ │ │ └── vue3.test.ts
│ │ └── diagnostics
│ │ │ ├── basic.ts
│ │ │ ├── eslint.test.ts
│ │ │ └── globalComponent.test.ts
│ ├── fixture
│ │ ├── package.json
│ │ ├── packages
│ │ │ ├── vue2
│ │ │ │ ├── completion
│ │ │ │ │ └── Alias.vue
│ │ │ │ ├── components
│ │ │ │ │ └── AppSpinner.vue
│ │ │ │ ├── diagnostics
│ │ │ │ │ └── ESLint.vue
│ │ │ │ ├── jsconfig.json
│ │ │ │ └── package.json
│ │ │ └── vue3
│ │ │ │ ├── package.json
│ │ │ │ └── src
│ │ │ │ ├── App.vue
│ │ │ │ ├── components
│ │ │ │ └── AppButton.vue
│ │ │ │ ├── data
│ │ │ │ └── test.json
│ │ │ │ └── tsconfig.json
│ │ ├── vetur.config.js
│ │ └── yarn.lock
│ ├── index.ts
│ └── path.ts
├── semanticTokenHelper.ts
├── tsconfig.json
├── util.ts
└── vue3
│ ├── data-dir
│ └── User
│ │ └── settings.json
│ ├── features
│ ├── beforeAll
│ │ └── beforeAll.test.ts
│ ├── completion
│ │ ├── basic.test.ts
│ │ ├── interpolation.test.ts
│ │ ├── interpolationClassComponent.test.ts
│ │ └── interpolationProperty.test.ts
│ ├── diagnostics
│ │ ├── emitTypeValidation.test.ts
│ │ ├── eslint.test.ts
│ │ ├── propTypeValidation.test.ts
│ │ ├── propValidation.test.ts
│ │ └── scriptSetup.test.ts
│ └── semanticTokens
│ │ └── basic.test.ts
│ ├── fixture
│ ├── .vscode
│ │ └── settings.json
│ ├── beforeAll.vue
│ ├── completion
│ │ ├── Basic.vue
│ │ └── interpolation
│ │ │ ├── Basic.vue
│ │ │ ├── Parent.vue
│ │ │ ├── classComponent
│ │ │ ├── Child.vue
│ │ │ └── Parent.vue
│ │ │ └── propertyDecorator
│ │ │ ├── Child.vue
│ │ │ ├── ChildWithEmitsOption.vue
│ │ │ └── Parent.vue
│ ├── diagnostics
│ │ ├── ESLint.vue
│ │ ├── emitTypeValidation
│ │ │ ├── JSChild.vue
│ │ │ ├── ParentRight.vue
│ │ │ ├── ParentWrong.vue
│ │ │ ├── PropertyChild.vue
│ │ │ └── TSChild.vue
│ │ ├── propTypeValidation
│ │ │ ├── JSChild.vue
│ │ │ ├── ParentRight.vue
│ │ │ ├── ParentWrong.vue
│ │ │ └── TSChild.vue
│ │ ├── propValidation
│ │ │ ├── ParentRight.vue
│ │ │ └── TSChild.vue
│ │ ├── scriptSetup1.vue
│ │ ├── scriptSetup2.vue
│ │ └── scriptSetupDiag.vue
│ ├── package.json
│ ├── semanticTokens
│ │ └── Basic.vue
│ ├── shims-vue.d.ts
│ ├── tsconfig.json
│ └── yarn.lock
│ ├── index.ts
│ └── path.ts
├── tsconfig.options.json
├── tslint.json
├── vti
├── README.md
├── bin
│ └── vti
├── package.json
├── rollup.config.js
├── src
│ ├── cli.ts
│ ├── commands
│ │ └── diagnostics.ts
│ └── initParams.ts
├── tsconfig.json
└── yarn.lock
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*]
2 | charset = utf-8
3 | indent_style = space
4 | indent_size = 2
5 | end_of_line = lf
6 | insert_final_newline = false
7 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Use LF for now to work around https://github.com/vuejs/vetur/issues/1319
2 | * text=auto eol=lf
3 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contribution Guide
2 |
3 | Contribution is welcome! There are many ways you could help Vetur's development:
4 |
5 | - Triaging Issues
6 | - Writing Code
7 | - Improving Doc
8 |
9 | For more information, please read: https://github.com/vuejs/vetur/wiki#contribution-guide.
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [octref]
4 | issuehunt: vuejs/vetur
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F41B Bug Report"
3 | about: Something doesn't work
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
12 | - [ ] I have searched through existing issues
13 | - [ ] I have read through [docs](https://vuejs.github.io/vetur)
14 | - [ ] I have read [FAQ](https://vuejs.github.io/vetur/guide/FAQ.html)
15 | - [ ] I have tried restarting VS Code or running `Vetur: Restart VLS`
16 |
17 | ## Info
18 |
19 | - Platform:
20 | - Vetur version:
21 | - VS Code version:
22 | - TypeScript version:
23 | - Vetur output:
24 | Output
25 |
26 |
27 | ```
28 |
29 | ```
30 |
31 |
32 |
33 | - Vetur doctor output
34 | Doctor output
35 |
36 |
37 | ```
38 |
39 | ```
40 |
41 |
42 |
43 |
44 | ## Problem
45 |
46 |
47 |
48 |
49 | ## Reproducible Case
50 |
51 |
59 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "\U0001F680 Feature Request"
3 | about: I have an idea for Vetur
4 | title: ''
5 | labels: feature
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
12 | - [ ] I have searched through existing issues
13 |
14 | ## Feature Request
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.github/NO_REPRO_CASE.md:
--------------------------------------------------------------------------------
1 | # No Repro Case Issues
2 |
3 | You are here because your issue is closed with `no-repro-case` tag. Please read below and open a new issue with repro case.
4 |
5 | ## What is a repro case?
6 |
7 | Repro case, short for *reproducible case*, refers to a minimal example that demonstrates the problem.
8 |
9 | Good repro cases help maintainers a lot:
10 |
11 | 1. They can be reproduced and debugged in maintainers' setup.
12 | 2. They demonstrate a singular bug in a simple setting, so it's easy to find the cause.
13 |
14 | Writing a good repro case helps *you* as well. In the process of reducing your question to the simplest form, you communicate more clearly, gain deeper understanding of the problem, and sometimes even figure out the cause of the bug yourself.
15 |
16 | ## How to create a repro case?
17 |
18 | Read Stack Overflow's guide to writing a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example), if you haven't.
19 |
20 | In the case of Vetur:
21 |
22 | - Clone https://github.com/octref/veturpack and install its dependencies
23 | - Make a minimal code change to demonstrate your problem
24 | - Push your commit to a fork
25 | - Include link to the fork in the issue
26 |
27 | **Note: Turn off all other Vue extensions. If your issue is about a Vetur setting, turn off all other Vetur settings and only change the setting which is causing issue.**
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: npm
4 | directory: "/"
5 | versioning-strategy: increase
6 | schedule:
7 | interval: "weekly"
8 | day: "friday"
9 | time: "06:00"
10 | timezone: "Asia/Shanghai"
11 | - package-ecosystem: npm
12 | directory: /server
13 | versioning-strategy: increase
14 | schedule:
15 | interval: "weekly"
16 | day: "friday"
17 | time: "06:00"
18 | timezone: "Asia/Shanghai"
19 | - package-ecosystem: npm
20 | directory: /vti
21 | versioning-strategy: increase
22 | schedule:
23 | interval: "weekly"
24 | day: "friday"
25 | time: "06:00"
26 | timezone: "Asia/Shanghai"
--------------------------------------------------------------------------------
/.github/workflows/rebase.yml:
--------------------------------------------------------------------------------
1 | on:
2 | issue_comment:
3 | types: [created]
4 | name: Automatic Rebase
5 | jobs:
6 | rebase:
7 | name: Rebase
8 | if: github.event.issue.pull_request != '' && github.event.comment.author_association == 'MEMBER' && contains(github.event.comment.body, '/rebase')
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Checkout the latest code
12 | uses: actions/checkout@v2
13 | with:
14 | fetch-depth: 0
15 | - name: Automatic Rebase
16 | uses: cirrus-actions/rebase@1.3.1
17 | env:
18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | npm-debug.log
3 |
4 | node_modules
5 | .vscode-test
6 |
7 | test/**/data-dir/**
8 | !test/**/data-dir/User
9 | test/**/data-dir/User/**
10 | !test/**/data-dir/User/settings.json
11 |
12 | dist
13 | server/dist
14 | server/typings
15 | docs/.vuepress/dist
16 | dist-test/
17 | server/dist-test/
18 |
19 | *.zip
20 | *.vsix
21 |
22 | .nyc_output
23 | coverage.lcov
24 |
25 | **/*.tsbuildinfo
26 |
--------------------------------------------------------------------------------
/.husky/.gitignore:
--------------------------------------------------------------------------------
1 | _
2 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | yarn lint-staged
5 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | server/src/modes/template/test/completion.test.ts
2 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 120,
3 | "semi": true,
4 | "singleQuote": true,
5 | "trailingComma": "none",
6 | "arrowParens": "avoid"
7 | }
8 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "docs/_book": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "type": "npm",
6 | "script": "watch",
7 | "problemMatcher": [
8 | "$tsc-watch"
9 | ],
10 | "group": {
11 | "kind": "build",
12 | "isDefault": true
13 | }
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .github/
2 | .vscode/
3 | .vscode-test/
4 | build/
5 | docs/
6 | client/
7 | **/test/
8 | server/src/
9 | server/typings
10 | vti
11 | dist-test/
12 | server/dist-test/
13 |
14 | server/node_modules/typescript/lib/tsc.js
15 | server/node_modules/typescript/lib/tsserver.js
16 | server/node_modules/typescript/lib/tsserverlibrary.js
17 | server/node_modules/typescript/lib/typescriptServices.js
18 |
19 | .**
20 |
21 | **/*.map
22 | **/tsconfig.json
23 | **/tsconfig.**.json
24 | **/tslint.json
25 | **/yarn.lock
26 |
27 | .vsix
28 | scripts
29 |
30 | node_modules/.cache/
31 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4 |
5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6 |
7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8 |
9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10 |
11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12 |
13 | This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at https://www.contributor-covenant.org/version/1/0/0/code-of-conduct.html
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Pine Wu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/asset/stepsize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuejs/vetur/96aaa707f8ca629f0883c57a47adb0e58995936d/asset/stepsize.png
--------------------------------------------------------------------------------
/asset/vue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuejs/vetur/96aaa707f8ca629f0883c57a47adb0e58995936d/asset/vue.png
--------------------------------------------------------------------------------
/build/release-cleanup.sh:
--------------------------------------------------------------------------------
1 | # Deps
2 | yarn --prod
3 |
4 | # Remove server devDependencies
5 | cd server && yarn --prod && cd ..
6 |
--------------------------------------------------------------------------------
/build/rollup-common-config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs');
3 | const json = require('@rollup/plugin-json');
4 | const commonjs = require('@rollup/plugin-commonjs');
5 | const typescript = require('rollup-plugin-typescript2');
6 | const resolve = require('@rollup/plugin-node-resolve').default;
7 | const { terser } = require('rollup-plugin-terser');
8 |
9 | const getRootPath = root => relative => path.resolve(__dirname, '../', root, relative);
10 |
11 | const clearDist = dist => {
12 | if (fs.existsSync(dist)) {
13 | fs.rmSync(dist, { recursive: true });
14 | }
15 | };
16 |
17 | const onwarn = (warning, warn) => {
18 | // typescript tslib
19 | if (warning.code === 'THIS_IS_UNDEFINED') return;
20 |
21 | warn(warning);
22 | };
23 |
24 | const external = [
25 | // node built-in
26 | 'path',
27 | 'fs',
28 | 'child_process',
29 | 'os',
30 | 'net',
31 | 'util',
32 | 'crypto',
33 | 'url',
34 | 'assert',
35 | 'inspector',
36 | 'module',
37 | 'events',
38 | 'tty',
39 | 'buffer',
40 | 'stream',
41 | 'string_decoder',
42 | 'perf_hooks',
43 | // vscode
44 | 'vscode'
45 | ];
46 |
47 | const createPlugins = tsconfig => [
48 | json(),
49 | resolve(),
50 | commonjs(),
51 | typescript({ tsconfig, tsconfigOverride: { compilerOptions: { module: 'esnext' } } }),
52 | terser()
53 | ];
54 |
55 | module.exports = {
56 | getRootPath,
57 | clearDist,
58 | onwarn,
59 | external,
60 | createPlugins
61 | };
62 |
--------------------------------------------------------------------------------
/build/update-docs.sh:
--------------------------------------------------------------------------------
1 | # Prepare
2 | cd docs
3 | rm -rf .vuepress/dist
4 |
5 | # Build
6 | vuepress build
7 |
8 | # Publish to GitHub Pages
9 | cd .vuepress/dist
10 | git init
11 | git add -A
12 | git commit -m '[vuepress] update docs'
13 | git push -f git@github.com:vuejs/vetur.git master:gh-pages
14 |
15 | # Cleanup
16 | cd ../..
17 | rm -rf .vuepress/dist
18 |
--------------------------------------------------------------------------------
/build/vsix-links.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Include VSIX Links in Changelog.md
3 | */
4 |
5 | const fs = require('fs');
6 | const path = require('path');
7 |
8 | const CHANGELOG_PATH = path.resolve(__dirname, '../CHANGELOG.md');
9 |
10 | const changelog = fs.readFileSync(CHANGELOG_PATH, 'utf-8');
11 |
12 | const newChangelog = changelog.replace(/### ([0-9.]+) \| ([0-9-]+)\n/g, (match, ver, date) => {
13 | const publisher = 'octref';
14 | const extname = 'vetur';
15 | const link = `https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${publisher}/vsextensions/${extname}/${ver}/vspackage`;
16 |
17 | return `### ${ver} | ${date} | [VSIX](${link})\n`;
18 | });
19 |
20 | fs.writeFileSync(CHANGELOG_PATH, newChangelog);
21 |
--------------------------------------------------------------------------------
/client/commands/doctorCommand.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 | import { LanguageClient } from 'vscode-languageclient/node';
3 |
4 | export function generateDoctorCommand(client: LanguageClient) {
5 | return async () => {
6 | if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document.fileName.endsWith('.vue')) {
7 | return vscode.window.showInformationMessage('Failed to doctor. Make sure the current file is a .vue file.');
8 | }
9 |
10 | const fileName = vscode.window.activeTextEditor.document.fileName;
11 |
12 | const result = (await client.sendRequest('$/doctor', { fileName })) as string;
13 | const showText = result.slice(0, 1000) + '....';
14 | const action = await vscode.window.showInformationMessage(showText, { modal: true }, 'Ok', 'Copy');
15 | if (action === 'Copy') {
16 | await vscode.env.clipboard.writeText(result);
17 | }
18 | };
19 | }
20 |
--------------------------------------------------------------------------------
/client/commands/generateGrammarCommand.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 | import { writeFileSync } from 'fs';
3 | import { resolve } from 'path';
4 | import { getGeneratedGrammar } from '../grammar';
5 |
6 | export function generateGrammarCommandHandler(extensionPath: string) {
7 | return () => {
8 | try {
9 | const customBlocks: { [k: string]: string } =
10 | vscode.workspace.getConfiguration().get('vetur.grammar.customBlocks') || {};
11 | const generatedGrammar = getGeneratedGrammar(
12 | resolve(extensionPath, 'syntaxes/vue.tmLanguage.json'),
13 | customBlocks
14 | );
15 | writeFileSync(resolve(extensionPath, 'syntaxes/vue-generated.json'), generatedGrammar, 'utf-8');
16 | vscode.window.showInformationMessage('Successfully generated vue grammar. Reload VS Code to enable it.');
17 | } catch (e) {
18 | console.error((e as Error).stack);
19 | vscode.window.showErrorMessage(
20 | 'Failed to generate vue grammar. `vetur.grammar.customBlocks` contain invalid language values'
21 | );
22 | }
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/client/commands/openUserScaffoldSnippetFolderCommand.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 | import * as fs from 'fs';
3 |
4 | export function generateOpenUserScaffoldSnippetFolderCommand(globalSnippetDir: string) {
5 | return async () => {
6 | const uri = vscode.Uri.file(globalSnippetDir);
7 |
8 | if (!fs.existsSync(uri.fsPath)) {
9 | fs.mkdirSync(uri.fsPath);
10 | }
11 |
12 | vscode.commands.executeCommand('vscode.openFolder', uri, true);
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/client/languages.ts:
--------------------------------------------------------------------------------
1 | import { languages, IndentAction } from 'vscode';
2 |
3 | const EMPTY_ELEMENTS: string[] = [
4 | 'area',
5 | 'base',
6 | 'br',
7 | 'col',
8 | 'embed',
9 | 'hr',
10 | 'img',
11 | 'input',
12 | 'keygen',
13 | 'link',
14 | 'menuitem',
15 | 'meta',
16 | 'param',
17 | 'source',
18 | 'track',
19 | 'wbr'
20 | ];
21 |
22 | export function registerLanguageConfigurations() {
23 | languages.setLanguageConfiguration('vue-html', {
24 | wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
25 | onEnterRules: [
26 | {
27 | beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
28 | afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>$/i,
29 | action: { indentAction: IndentAction.IndentOutdent }
30 | },
31 | {
32 | beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
33 | action: { indentAction: IndentAction.Indent }
34 | }
35 | ]
36 | });
37 | }
38 |
--------------------------------------------------------------------------------
/client/rollup.config.js:
--------------------------------------------------------------------------------
1 | const { getRootPath, clearDist, external, createPlugins } = require('../build/rollup-common-config');
2 | const clientPkg = require('../package.json');
3 |
4 | const getClientPath = getRootPath('client');
5 |
6 | clearDist(getClientPath('../dist'));
7 | module.exports = {
8 | input: getClientPath('vueMain.ts'),
9 | output: { file: clientPkg.main, name: clientPkg.name, format: 'cjs', sourcemap: true },
10 | external,
11 | watch: {
12 | include: getClientPath('**')
13 | },
14 | plugins: createPlugins(getClientPath('tsconfig.json'))
15 | };
16 |
--------------------------------------------------------------------------------
/client/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.options.json",
3 | "compilerOptions": {
4 | "composite": true,
5 | "outDir": "../dist",
6 | "rootDir": ".."
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/client/userSnippetDir.ts:
--------------------------------------------------------------------------------
1 |
2 | import { homedir } from 'os';
3 | import { resolve } from 'path';
4 |
5 | export function getGlobalSnippetDir(isInsiders: boolean) {
6 | const appName = isInsiders ? 'Code - Insiders' : 'Code';
7 |
8 | if (process.platform === 'win32') {
9 | return resolve(process.env['APPDATA'] || '', appName, 'User/snippets/vetur');
10 | } else if (process.platform === 'darwin') {
11 | return resolve(homedir(), 'Library/Application Support', appName, 'User/snippets/vetur');
12 | } else {
13 | return resolve(homedir(), '.config', appName, 'User/snippets/vetur');
14 | }
15 | }
--------------------------------------------------------------------------------
/docs/.vuepress/config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | title: 'Vetur',
3 | description: 'Vue tooling for VS Code.',
4 | base: '/vetur/',
5 | markdown: {
6 | linkify: true
7 | },
8 | themeConfig: {
9 | repo: 'vuejs/vetur',
10 | editLinks: true,
11 | docsDir: 'docs',
12 | nav: [
13 | { text: 'Guide', link: '/guide/' },
14 | { text: 'Reference', link: '/reference/' },
15 | { text: 'FAQ', link: '/guide/FAQ' },
16 | { text: 'Roadmap', link: 'https://github.com/vuejs/vetur/issues/873' },
17 | { text: 'Credits', link: '/credits' },
18 | { text: 'Contribution Guide', link: 'https://github.com/vuejs/vetur/wiki#contribution-guide' }
19 | ],
20 | sidebar: {
21 | '/guide/': [
22 | '',
23 | 'setup',
24 | {
25 | title: 'Features',
26 | collapsable: false,
27 | children: [
28 | 'highlighting',
29 | 'semantic-highlighting',
30 | 'snippet',
31 | 'emmet',
32 | 'linting-error',
33 | 'formatting',
34 | 'intellisense',
35 | 'debugging',
36 | 'component-data',
37 | 'interpolation',
38 | 'vti',
39 | 'global-components'
40 | ]
41 | },
42 | 'FAQ'
43 | ],
44 | '/reference/': ['', 'tsconfig']
45 | }
46 | }
47 | };
48 |
--------------------------------------------------------------------------------
/docs/credits.md:
--------------------------------------------------------------------------------
1 | # Credits
2 |
3 | Main Developer: [@octref](https://github.com/octref)
4 |
5 | Contributors:
6 | - [@HerringtonDarkholme](https://github.com/HerringtonDarkholme)
7 | - [@sandersn](https://github.com/sandersn)
8 | - [@yoyo930021](https://github.com/yoyo930021)
9 | - [@ktsn](https://github.com/ktsn)
10 | - [@rchl](https://github.com/rchl)
11 | - [@Uninen](https://github.com/Uninen)
12 |
13 | Others: https://github.com/vuejs/vetur/graphs/contributors
14 |
15 | ### Attributions
16 |
17 | Vetur is based on Microsoft's [html language service](https://github.com/Microsoft/vscode/tree/master/extensions/html) for VS Code.
18 |
19 | Others:
20 | - Logo from [vuejs/vuejs.org](https://github.com/vuejs/vuejs.org)
21 | - Grammar based on [vuejs/vue-syntax-highlight](https://github.com/vuejs/vue-syntax-highlight)
22 | - Sass grammar based on [TheRealSyler/vscode-sass-indented](https://github.com/TheRealSyler/vscode-sass-indented)
23 | - PostCSS grammar based on [hudochenkov/Syntax-highlighting-for-PostCSS](https://github.com/hudochenkov/Syntax-highlighting-for-PostCSS)
24 | - TypeScript/JavaScript based on [TypeScript](https://github.com/microsoft/TypeScript/#readme)
25 | - CSS/SCSS/LESS feature based on [vscode-css-languageservice](https://github.com/microsoft/vscode-css-languageservice)
26 |
--------------------------------------------------------------------------------
/docs/guide/debugging.md:
--------------------------------------------------------------------------------
1 | # Debugging
2 |
3 | See [https://github.com/Microsoft/vscode-recipes/tree/master/vuejs-cli](https://github.com/Microsoft/vscode-recipes/tree/master/vuejs-cli).
4 |
--------------------------------------------------------------------------------
/docs/guide/emmet.md:
--------------------------------------------------------------------------------
1 | # Emmet
2 |
3 | New Emmet support is available for `html`, `css`, `scss`, `less`, `stylus`, `sass` without any configuration for VS Code 1.15.0+.
4 |
--------------------------------------------------------------------------------
/docs/guide/global-components.md:
--------------------------------------------------------------------------------
1 | # Global components
2 |
3 | Vetur support define global components.
4 | You can register template interpolation for that components anywhere in the project.
5 |
6 | Please add `projects.globalComponents` in `vetur.config.js`.
7 |
8 | ## Example
9 | When your project isn't a monorepo and `package.json/(ts|js)config.json` at project root.
10 | ```javascript
11 | // vetur.config.js
12 | /** @type {import('vls').VeturConfig} */
13 | module.exports = {
14 | projects: [
15 | {
16 | root: './',
17 | // **optional** default: `[]`
18 | // Register globally Vue component glob.
19 | // If you set it, you can get completion by that components.
20 | // It is relative to root property.
21 | // Notice: It won't actually do it. You need to use `require.context` or `Vue.component`
22 | globalComponents: [
23 | './src/components/**/*.vue',
24 | {
25 | // Component name
26 | name: 'FakeButton',
27 | // Component file path, please use '/'.
28 | path: './src/app/components/AppButton.vue'
29 | }
30 | ]
31 | }
32 | ]
33 | }
34 | ```
35 |
36 |
--------------------------------------------------------------------------------
/docs/guide/semantic-highlighting.md:
--------------------------------------------------------------------------------
1 | # Semantic Highlighting
2 |
3 | https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide
4 |
5 | Vetur supports semantic highlighting for the following languages:
6 | - TypeScript
7 | - JavaScript
8 |
9 | ## Ref in composition API
10 |
11 | The `.value` will get `property.refValue`.
12 | Vetur will automatic underline `.value`. You can set `{ "vetur.underline.refValue": false }` to close it in vscode setting.
13 |
14 | And use this setting for customize style.
15 | ```json
16 | {
17 | "editor.semanticTokenColorCustomizations": {
18 | "enabled": true,
19 | "rules": {
20 | "property.refValue": {
21 | "underline": true
22 | }
23 | }
24 | }
25 | }
26 | ```
27 |
--------------------------------------------------------------------------------
/docs/guide/vti.md:
--------------------------------------------------------------------------------
1 | # VTI
2 |
3 | 🚧 WIP. This feature is not stable yet. 🚧
4 |
5 | VTI (Vetur Terminal Interface) is a CLI that exposes some of Vetur's language features:
6 |
7 | - [x] Diagnostic errors
8 | - [ ] Formatting
9 |
10 | ## Why
11 |
12 | VTI catches type-errors in Vue templates that's not catchable by either Vue or TypeScript alone.
13 |
14 | - Vue compiler: do not understand types.
15 | - TypeScript compiler: do not understand Vue templates.
16 | - VLS: Understand both to do [TS type-checking on Vue templates](https://vuejs.github.io/vetur/guide/interpolation.html).
17 | - VTI: Surfaces VLS's errors on CLI for CI.
18 |
19 | ## Usage
20 |
21 | ```bash
22 | npm i -g vti
23 | # or yarn global add vti
24 | # run this in the root of a Vue project
25 | vti
26 | vti diagnostics
27 | ```
28 |
29 | .
30 |
31 | You also can use [`vetur.config.js`](/reference/) for setting VTI.
32 |
33 | Currently, this is only used for generating interpolation type-checking errors on CLI, which
34 | neither Vue's compiler nor Webpack would catch.
35 |
36 | Please send feedback to: https://github.com/vuejs/vetur/issues/1635.
37 |
--------------------------------------------------------------------------------
/docs/images/debug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuejs/vetur/96aaa707f8ca629f0883c57a47adb0e58995936d/docs/images/debug.png
--------------------------------------------------------------------------------
/docs/images/scope.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuejs/vetur/96aaa707f8ca629f0883c57a47adb0e58995936d/docs/images/scope.png
--------------------------------------------------------------------------------
/docs/images/snippet-main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuejs/vetur/96aaa707f8ca629f0883c57a47adb0e58995936d/docs/images/snippet-main.png
--------------------------------------------------------------------------------
/docs/images/snippet-partial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuejs/vetur/96aaa707f8ca629f0883c57a47adb0e58995936d/docs/images/snippet-partial.png
--------------------------------------------------------------------------------
/docs/reference/package.md:
--------------------------------------------------------------------------------
1 | ## package.json
2 |
3 | Same as `package.json` in nodejs project.
4 | Vetur infer vue version and support other libs from this file.
5 |
--------------------------------------------------------------------------------
/docs/reference/tsconfig.md:
--------------------------------------------------------------------------------
1 | # Javascript / Typescript config
2 |
3 | See https://www.typescriptlang.org/tsconfig
4 |
--------------------------------------------------------------------------------
/languages/vue-html-language-configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | "blockComment": [ "" ]
4 | },
5 | "brackets": [
6 | [""],
7 | ["<", ">"],
8 | ["{", "}"],
9 | ["(", ")"]
10 | ],
11 | "colorizedBracketPairs": [
12 | ["{", "}"],
13 | ["{{", "}}"],
14 | ["[", "]"],
15 | ["(", ")"]
16 | ],
17 | "autoClosingPairs": [
18 | { "open": "{", "close": "}"},
19 | { "open": "[", "close": "]"},
20 | { "open": "(", "close": ")" },
21 | { "open": "'", "close": "'" },
22 | { "open": "\"", "close": "\"" }
23 | ],
24 | "surroundingPairs": [
25 | { "open": "'", "close": "'" },
26 | { "open": "\"", "close": "\"" },
27 | { "open": "{", "close": "}"},
28 | { "open": "[", "close": "]"},
29 | { "open": "(", "close": ")" },
30 | { "open": "<", "close": ">" }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/languages/vue-language-configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | // symbol used for single line comment. Remove this entry if your language does not support line comments
4 | "lineComment": "//",
5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6 | "blockComment": [ "/*", "*/" ]
7 | },
8 | // symbols used as brackets
9 | "brackets": [
10 | ["{", "}"],
11 | ["[", "]"],
12 | ["(", ")"]
13 | ],
14 | // symbols that are auto closed when typing
15 | "autoClosingPairs": [
16 | { "open": "{", "close": "}" },
17 | { "open": "[", "close": "]" },
18 | { "open": "(", "close": ")" },
19 | { "open": "\"", "close": "\"", "notIn": ["string"] },
20 | { "open": "'", "close": "'", "notIn": ["string", "comment"] },
21 | { "open": "`", "close": "`", "notIn": ["string", "comment"] },
22 | { "open": "/**", "close": " */", "notIn": ["string"] }
23 | ],
24 | // symbols that that can be used to surround a selection
25 | "surroundingPairs": [
26 | ["{", "}"],
27 | ["[", "]"],
28 | ["(", ")"],
29 | ["\"", "\""],
30 | ["'", "'"],
31 | ["`", "`"]
32 | ],
33 | "folding": {
34 | "markers": {
35 | "start": "^<(template|style|script)[^>]*>",
36 | "end": "^(template|style|script)>"
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/languages/vue-postcss-language-configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments
4 | "blockComment": [ "/*", "*/" ]
5 | },
6 | // symbols used as brackets
7 | "brackets": [
8 | ["{", "}"],
9 | ["[", "]"],
10 | ["(", ")"]
11 | ],
12 | // symbols that are auto closed when typing
13 | "autoClosingPairs": [
14 | ["{", "}"],
15 | ["[", "]"],
16 | ["(", ")"],
17 | ["\"", "\""],
18 | ["'", "'"]
19 | ],
20 | // symbols that that can be used to surround a selection
21 | "surroundingPairs": [
22 | ["{", "}"],
23 | ["[", "]"],
24 | ["(", ")"],
25 | ["\"", "\""],
26 | ["'", "'"]
27 | ]
28 | }
--------------------------------------------------------------------------------
/languages/vue-pug-language-configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | "lineComment": "//-"
4 | },
5 | "brackets": [
6 | ["{", "}"],
7 | ["[", "]"],
8 | ["(", ")"]
9 | ],
10 | "autoClosingPairs": [
11 | ["{", "}"],
12 | ["[", "]"],
13 | ["(", ")"],
14 | ["'", "'"],
15 | ["\"", "\""]
16 | ],
17 | "surroundingPairs": [
18 | ["{", "}"],
19 | ["[", "]"],
20 | ["(", ")"],
21 | ["'", "'"],
22 | ["\"", "\""]
23 | ],
24 | "folding": {
25 | "offSide": true
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/languages/vue-sugarss-language-configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "comments": {
3 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments
4 | "blockComment": [ "/*", "*/" ]
5 | },
6 | // symbols used as brackets
7 | "brackets": [
8 | ["[", "]"],
9 | ["(", ")"]
10 | ],
11 | // symbols that are auto closed when typing
12 | "autoClosingPairs": [
13 | ["[", "]"],
14 | ["(", ")"],
15 | ["\"", "\""],
16 | ["'", "'"]
17 | ],
18 | // symbols that that can be used to surround a selection
19 | "surroundingPairs": [
20 | ["[", "]"],
21 | ["(", ")"],
22 | ["\"", "\""],
23 | ["'", "'"]
24 | ]
25 | }
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | module.exports = [
2 | require('./client/rollup.config.js'),
3 | ...require('./server/rollup.config.js'),
4 | require('./vti/rollup.config.js')
5 | ];
6 |
--------------------------------------------------------------------------------
/scripts/build_grammar.ts:
--------------------------------------------------------------------------------
1 | import glob from 'glob';
2 | import { load } from 'js-yaml';
3 | import { writeFileSync, readFileSync } from 'fs';
4 | import { parse } from 'path';
5 | import { getGeneratedGrammar } from '../client/grammar';
6 |
7 | glob('syntaxes/**/*.yaml', { nocase: true }, (_, files) => {
8 | for (const file of files) {
9 | const pathData = parse(file);
10 | writeFileSync(
11 | pathData.dir + '/' + pathData.name + '.tmLanguage.json',
12 | JSON.stringify(load(readFileSync(file).toString()), null, 2)
13 | );
14 | }
15 |
16 | console.log('Built files:\n', JSON.stringify(files));
17 |
18 | // get default custom blocks from package json
19 | const pJson = JSON.parse(readFileSync('package.json').toString());
20 | const defaultCustomBlocks = pJson.contributes.configuration.properties['vetur.grammar.customBlocks'].default;
21 | const generatedGrammar = getGeneratedGrammar('syntaxes/vue.tmLanguage.json', defaultCustomBlocks);
22 | writeFileSync('syntaxes/vue-generated.json', generatedGrammar);
23 | console.log('Generated vue-generated.json');
24 | });
25 |
--------------------------------------------------------------------------------
/scripts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.options.json",
3 | "compilerOptions": {
4 | "composite": true,
5 | "outDir": "../dist",
6 | "rootDir": ".."
7 | },
8 | "references": [
9 | { "path": "../client" }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | typings
4 |
--------------------------------------------------------------------------------
/server/.mocharc.yml:
--------------------------------------------------------------------------------
1 | ui: tdd
2 | color: true
3 | require: 'source-map-support/register'
4 | spec: './dist-test/**/*.test.js'
5 |
--------------------------------------------------------------------------------
/server/.npmrc:
--------------------------------------------------------------------------------
1 | message = "Vue Language Server %s"
2 |
--------------------------------------------------------------------------------
/server/bin/vls:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | require('../dist/vueServerMain.js')
3 |
--------------------------------------------------------------------------------
/server/src/log.ts:
--------------------------------------------------------------------------------
1 | const enum DEBUG_LEVEL {
2 | DEBUG = 0,
3 | INFO = 1
4 | }
5 |
6 | export const logger = {
7 | _level: DEBUG_LEVEL.INFO,
8 |
9 | setLevel(level: string) {
10 | if (level === 'DEBUG') {
11 | this._level = DEBUG_LEVEL.DEBUG;
12 | } else {
13 | this._level = DEBUG_LEVEL.INFO;
14 | }
15 | },
16 |
17 | logDebug(msg: string) {
18 | if (this._level <= DEBUG_LEVEL.DEBUG) {
19 | console.log(`[DEBUG] ${msg}`);
20 | }
21 | },
22 | logInfo(msg: string) {
23 | console.log(`[INFO ] ${msg}`);
24 | }
25 | };
26 |
--------------------------------------------------------------------------------
/server/src/modes/nullMode.ts:
--------------------------------------------------------------------------------
1 | import { LanguageMode } from '../embeddedSupport/languageModes';
2 | import { CompletionList } from 'vscode-languageserver-types';
3 |
4 | export const NULL_HOVER = {
5 | contents: []
6 | };
7 |
8 | export const NULL_SIGNATURE = null;
9 |
10 | export const NULL_COMPLETION: CompletionList = {
11 | isIncomplete: false,
12 | items: []
13 | };
14 |
15 | export const nullMode: LanguageMode = {
16 | getId: () => '',
17 | onDocumentRemoved() {},
18 | dispose() {},
19 | doHover: () => NULL_HOVER,
20 | doComplete: () => NULL_COMPLETION,
21 | doSignatureHelp: () => NULL_SIGNATURE,
22 | findReferences: () => []
23 | };
24 |
--------------------------------------------------------------------------------
/server/src/modes/pug/languageService.ts:
--------------------------------------------------------------------------------
1 | import lex, { Loc } from 'pug-lexer';
2 | import { Position, Range } from 'vscode-languageserver-types';
3 |
4 | export function findTokenAtPosition(code: string, position: Position): lex.Token | null {
5 | const tokens = lex(code);
6 |
7 | const oneBasedPos = Position.create(position.line + 1, position.character + 1);
8 |
9 | return (
10 | tokens.find(
11 | ({ loc, type }) =>
12 | loc.start.line <= oneBasedPos.line &&
13 | loc.end.line >= oneBasedPos.line &&
14 | loc.start.column <= oneBasedPos.character &&
15 | loc.end.column > oneBasedPos.character &&
16 | type !== 'newline'
17 | ) || null
18 | );
19 | }
20 |
21 | export const locToRange = (loc: Loc): Range => ({
22 | start: Position.create(loc.start.line - 1, loc.start.column - 1),
23 | end: Position.create(loc.end.line - 1, loc.end.column - 1)
24 | });
25 |
--------------------------------------------------------------------------------
/server/src/modes/style/emmet.ts:
--------------------------------------------------------------------------------
1 | export enum StylePriority {
2 | Emmet,
3 | Platform
4 | }
5 |
--------------------------------------------------------------------------------
/server/src/modes/style/stylus/css-browser-data.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import {
7 | CSSDataV1,
8 | IPropertyData,
9 | IAtDirectiveData,
10 | IPseudoClassData,
11 | IPseudoElementData
12 | } from 'vscode-css-languageservice';
13 | // @ts-ignore
14 | import CssData from 'vscode-web-custom-data/data/browsers.css-data.json';
15 |
16 | export interface LoadedCSSData {
17 | properties: IPropertyData[];
18 | atDirectives: IAtDirectiveData[];
19 | pseudoClasses: IPseudoClassData[];
20 | pseudoElements: IPseudoElementData[];
21 | }
22 |
23 | const rawData = CssData as CSSDataV1;
24 |
25 | export const cssData: LoadedCSSData = {
26 | properties: rawData.properties || [],
27 | atDirectives: rawData.atDirectives || [],
28 | pseudoClasses: rawData.pseudoClasses || [],
29 | pseudoElements: rawData.pseudoElements || []
30 | };
31 |
--------------------------------------------------------------------------------
/server/src/modes/style/stylus/stylus-hover.ts:
--------------------------------------------------------------------------------
1 | import { Position, Hover, Range } from 'vscode-languageserver-types';
2 | import type { TextDocument } from 'vscode-languageserver-textdocument';
3 |
4 | import { buildAst, findNodeAtPosition } from './parser';
5 |
6 | import { cssData } from './css-browser-data';
7 | import _ from 'lodash';
8 |
9 | export function stylusHover(document: TextDocument, position: Position): Hover {
10 | const ast = buildAst(document.getText());
11 | if (!ast) {
12 | return {
13 | contents: ''
14 | };
15 | }
16 | const node = findNodeAtPosition(ast, position);
17 | if (!node) {
18 | return {
19 | contents: 'no node found!'
20 | };
21 | }
22 |
23 | if (node.__type === 'Property') {
24 | const property = node.segments[0].name;
25 | const properties = cssData.properties;
26 | const item = _.find(properties, item => item.name === property);
27 | const lineno = node.lineno - 1;
28 | const column = node.column;
29 | return {
30 | contents: (item && item.description) || 'unknown property',
31 | range: Range.create(lineno, column, lineno, column + properties.length)
32 | };
33 | }
34 | return {
35 | contents: []
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/server/src/modes/style/stylus/stylus-supremacy.ts:
--------------------------------------------------------------------------------
1 | import { FormattingOptions } from 'stylus-supremacy';
2 |
3 | export interface IStylusSupremacy {
4 | createFormattingOptions(options: any): FormattingOptions;
5 | createFormattingOptionsFromStylint(options: any): FormattingOptions;
6 | format(content: string, options: FormattingOptions): string;
7 | }
8 |
--------------------------------------------------------------------------------
/server/src/modes/style/stylus/test/completion.test.ts:
--------------------------------------------------------------------------------
1 | import { CompletionTestSetup, testDSL } from '../../../test-util/completion-test-util';
2 |
3 | import { provideCompletionItems } from '../completion-item';
4 |
5 | const setup: CompletionTestSetup = {
6 | langId: 'stylus',
7 | docUri: 'test://test/test.styl',
8 | doComplete(doc, pos) {
9 | return provideCompletionItems(doc, pos);
10 | }
11 | };
12 |
13 | const stylus = testDSL(setup);
14 |
15 | suite('Stylus Completion', () => {
16 | test('basic property', () => {
17 | stylus`back|`.has('background');
18 |
19 | stylus`.back|`.hasNo('background');
20 |
21 | stylus`
22 | .background
23 | back|`.has('background');
24 | });
25 |
26 | test('variable', () => {
27 | stylus`
28 | test-var = red
29 | .test-selector
30 | color te|`.has('test-var');
31 |
32 | stylus`
33 | .test-selector
34 | test-var = red
35 | color test-var
36 | .another-var
37 | hehe te|`.hasNo('test-var');
38 |
39 | stylus`
40 | test-var = red
41 | .test-selector
42 | te|`.hasNo('test-var');
43 |
44 | stylus`
45 | test-func(n)
46 | background n
47 | .test-selector
48 | te|`.has('test-func');
49 | });
50 | });
51 |
--------------------------------------------------------------------------------
/server/src/modes/style/stylus/test/hover.test.ts:
--------------------------------------------------------------------------------
1 | import { hoverDSL } from '../../../test-util/hover-test-util';
2 |
3 | import { stylusHover } from '../stylus-hover';
4 |
5 | const stylus = hoverDSL({
6 | langId: 'stylus',
7 | docUri: 'test://test/test.styl',
8 | doHover(doc, pos) {
9 | return stylusHover(doc, pos);
10 | }
11 | });
12 |
13 | suite('Stylus Hover', () => {
14 | test('property hover', () => {
15 | stylus`.test
16 | cu|rsor pointer`.hasHoverAt('Allows control over cursor appearance in an element', 9);
17 |
18 | stylus`.test
19 | cu|rsor: pointer`.hasHoverAt('Allows control over cursor appearance in an element', 9);
20 |
21 | stylus`.test
22 | |cursor: pointer`.hasHoverAt('Allows control over cursor appearance in an element', 9);
23 |
24 | stylus`.test
25 | cursor|: pointer`.hasHoverAt('Allows control over cursor appearance in an element', 9);
26 |
27 | stylus`.test
28 | cursor: p|ointer`.hasNothing();
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/server/src/modes/template-common/tagDefinition.ts:
--------------------------------------------------------------------------------
1 | import { Range, Location } from 'vscode-languageserver-types';
2 | import { VueFileInfo } from '../../services/vueInfoService';
3 | import { URI } from 'vscode-uri';
4 | import { kebabCase } from 'lodash';
5 |
6 | export function getTagDefinition(vueFileInfo: VueFileInfo, tag: string): Location[] {
7 | if (!vueFileInfo.componentInfo.childComponents) {
8 | return [];
9 | }
10 |
11 | const childComponent = vueFileInfo.componentInfo.childComponents.find(
12 | cc => !!cc.definition && [tag, tag.toLowerCase(), kebabCase(tag)].includes(cc.name)
13 | );
14 |
15 | if (!childComponent) {
16 | return [];
17 | }
18 |
19 | const loc: Location = {
20 | uri: URI.file(childComponent.definition!.path).toString(),
21 | // TODO: Resolve actual default export range
22 | range: Range.create(0, 0, 0, 0)
23 | };
24 | return [loc];
25 | }
26 |
--------------------------------------------------------------------------------
/server/src/modes/template/services/isInsideInterpolation.ts:
--------------------------------------------------------------------------------
1 | import { Node } from '../parser/htmlParser';
2 | import { parse } from 'vue-eslint-parser';
3 |
4 | const PARSER_PRE = '';
5 | const PARSER_POS = '';
6 |
7 | export function isInsideInterpolation(node: Node, nodeText: string, relativePos: number) {
8 | // Case {{ }}
9 | if (node.isInterpolation && relativePos >= '{{'.length && relativePos <= nodeText.length - '}}'.length) {
10 | return true;
11 | }
12 |
13 | // Case v-, : or @ directives
14 | const templateBody = parse(PARSER_PRE + nodeText + PARSER_POS, {}).templateBody;
15 | if (!templateBody) {
16 | return false;
17 | }
18 |
19 | const onlyChild = templateBody.children[0];
20 |
21 | if (!onlyChild || onlyChild.type !== 'VElement') {
22 | return false;
23 | }
24 |
25 | if (!onlyChild.startTag || !onlyChild.range) {
26 | return false;
27 | }
28 |
29 | if (!isInsideRange(onlyChild.startTag)) {
30 | return false;
31 | }
32 |
33 | for (const a of onlyChild.startTag.attributes) {
34 | if (isInsideRange(a) && a.directive) {
35 | if (a.value) {
36 | return isInsideRange(a.value);
37 | }
38 | }
39 | }
40 |
41 | return false;
42 |
43 | function isInsideRange(node: { range: number[] }) {
44 | const [start, end] = node.range;
45 |
46 | return start - PARSER_PRE.length < relativePos && end - PARSER_PRE.length > relativePos;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/server/src/modes/template/tagProviders/nuxtTags.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 | import { getExternalTagProvider } from './externalTagProviders';
3 |
4 | const NUXT_JSON_SOURCES = ['@nuxt/vue-app-edge', '@nuxt/vue-app', 'nuxt-helper-json'];
5 |
6 | export function getNuxtTagProvider(packageRoot: string) {
7 | let nuxtTags, nuxtAttributes;
8 | for (const source of NUXT_JSON_SOURCES) {
9 | if (tryResolve(join(source, 'package.json'), packageRoot)) {
10 | nuxtTags = tryRequire(join(source, 'vetur/nuxt-tags.json'), packageRoot);
11 | nuxtAttributes = tryRequire(join(source, 'vetur/nuxt-attributes.json'), packageRoot);
12 | if (nuxtTags) {
13 | break;
14 | }
15 | }
16 | }
17 |
18 | const componentsTags = tryRequire(join(packageRoot, '.nuxt/vetur/tags.json'), packageRoot);
19 | const componentsAttributes = tryRequire(join(packageRoot, '.nuxt/vetur/attributes.json'), packageRoot);
20 |
21 | return getExternalTagProvider(
22 | 'nuxt',
23 | { ...nuxtTags, ...componentsTags },
24 | { ...nuxtAttributes, ...componentsAttributes }
25 | );
26 | }
27 |
28 | function tryRequire(modulePath: string, findPath: string) {
29 | try {
30 | const resolved = tryResolve(modulePath, findPath);
31 | return resolved ? require(resolved) : undefined;
32 | } catch (_err) {}
33 | }
34 |
35 | function tryResolve(modulePath: string, findPath: string) {
36 | try {
37 | return require.resolve(modulePath, {
38 | paths: [findPath, __dirname]
39 | });
40 | } catch (_err) {}
41 | }
42 |
--------------------------------------------------------------------------------
/server/src/modes/template/test/emmet.test.ts:
--------------------------------------------------------------------------------
1 | import { CompletionTestSetup, testDSL } from '../../test-util/completion-test-util';
2 |
3 | import { parseHTMLDocument } from '../parser/htmlParser';
4 | import { doComplete } from '../services/htmlCompletion';
5 |
6 | const setup: CompletionTestSetup = {
7 | langId: 'vue-html',
8 | docUri: 'test://test/test.html',
9 | doComplete(doc, pos) {
10 | const htmlDoc = parseHTMLDocument(doc);
11 | return doComplete(doc, pos, htmlDoc, [], {});
12 | }
13 | };
14 |
15 | const vueHtml = testDSL(setup);
16 |
17 | suite('Emmet Completion', () => {
18 | test('Emmet HTML Expansion', () => {
19 | vueHtml`ul>li*3|`.has(`ul>li*3`).become(
20 | `
21 | \t- \${1}
22 | \t- \${2}
23 | \t- \${0}
24 |
`
25 | );
26 |
27 | vueHtml`{{ul>li*3|}}`.hasNo(`ul>li*3`);
28 |
29 | vueHtml`div+p|`.has(`div+p`).become(
30 | `\${1}
31 | \${0}
`
32 | );
33 | });
34 |
35 | vueHtml`#header|`.has(`#header`).become(``);
36 | });
37 |
--------------------------------------------------------------------------------
/server/src/modes/template/test/hover.test.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 | 'use strict';
6 |
7 | import { parseHTMLDocument } from '../parser/htmlParser';
8 | import { doHover } from '../services/htmlHover';
9 | import { hoverDSL } from '../../test-util/hover-test-util';
10 | import { allTagProviders } from '../tagProviders';
11 |
12 | const html = hoverDSL({
13 | docUri: 'test://test/test.html',
14 | langId: 'vue-html',
15 | doHover(document, position) {
16 | const htmlAST = parseHTMLDocument(document);
17 | return doHover(document, position, htmlAST, allTagProviders);
18 | }
19 | });
20 |
21 | suite('HTML Hover', () => {
22 | test('Attribute', function () {
23 | // prettier-ignore
24 | html``
25 | .hasNothing();
26 | // prettier-ignore
27 | html``
28 | .hasHoverAt('treat inner content as its template rather than distributed content', 11);
29 | // prettier-ignore
30 | html``
31 | .hasHoverAt('Conditionally renders the element based on the truthy-ness of the expression value.\n\n[API Reference](https://vuejs.org/v2/api/#v-if)', 5);
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/default.vue:
--------------------------------------------------------------------------------
1 |
2 | ${0}
3 |
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/script/composition-js-vue2.vue:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/script/composition-js.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/script/composition-ts-vue2.vue:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/script/composition-ts.vue:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/script/javascript.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/script/typescript.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/css-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/css.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/less-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/less.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/postcss-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/postcss.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/sass-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/sass.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/scss-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/scss.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/sss-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/sss.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/stylus-scoped.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/style/stylus.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/template/html.vue:
--------------------------------------------------------------------------------
1 |
2 | \t${0}
3 |
--------------------------------------------------------------------------------
/server/src/modes/vue/veturSnippets/template/pug.vue:
--------------------------------------------------------------------------------
1 |
2 | \t${0}
3 |
--------------------------------------------------------------------------------
/server/src/services/EnvironmentService.ts:
--------------------------------------------------------------------------------
1 | import { BasicComponentInfo, VLSConfig, VLSFullConfig } from '../config';
2 | import { inferVueVersion, VueVersion } from '../utils/vueVersion';
3 |
4 | export interface EnvironmentService {
5 | configure(config: VLSFullConfig): void;
6 | getConfig(): VLSFullConfig;
7 | getRootPathForConfig(): string;
8 | getProjectRoot(): string;
9 | getTsConfigPath(): string | undefined;
10 | getPackagePath(): string | undefined;
11 | getVueVersion(): VueVersion;
12 | getSnippetFolder(): string;
13 | getGlobalComponentInfos(): BasicComponentInfo[];
14 | }
15 |
16 | export function createEnvironmentService(
17 | rootPathForConfig: string,
18 | projectPath: string,
19 | tsconfigPath: string | undefined,
20 | packagePath: string | undefined,
21 | snippetFolder: string,
22 | globalComponentInfos: BasicComponentInfo[],
23 | initialConfig: VLSConfig
24 | ): EnvironmentService {
25 | let $config = initialConfig;
26 |
27 | return {
28 | configure(config: VLSFullConfig) {
29 | $config = config;
30 | },
31 | getConfig: () => $config,
32 | getRootPathForConfig: () => rootPathForConfig,
33 | getProjectRoot: () => projectPath,
34 | getTsConfigPath: () => tsconfigPath,
35 | getPackagePath: () => packagePath,
36 | getVueVersion: () => inferVueVersion(packagePath),
37 | getSnippetFolder: () => snippetFolder,
38 | getGlobalComponentInfos: () => globalComponentInfos
39 | };
40 | }
41 |
--------------------------------------------------------------------------------
/server/src/services/RefTokenService.ts:
--------------------------------------------------------------------------------
1 | import { Connection, Range } from 'vscode-languageserver';
2 |
3 | export interface RefTokensService {
4 | send(uri: string, tokens: Range[]): void;
5 | }
6 |
7 | export function createRefTokensService(conn: Connection) {
8 | return {
9 | send(uri: string, tokens: Range[]) {
10 | conn.sendNotification('$/refTokens', { uri, tokens });
11 | }
12 | };
13 | }
14 |
--------------------------------------------------------------------------------
/server/src/services/documentService.ts:
--------------------------------------------------------------------------------
1 | import { Connection, TextDocuments } from 'vscode-languageserver';
2 | import { TextDocument } from 'vscode-languageserver-textdocument';
3 |
4 | /**
5 | * Service responsible for managing documents being syned through LSP
6 | * Todo - Switch to incremental sync
7 | */
8 | export class DocumentService {
9 | private documents: TextDocuments;
10 |
11 | constructor(conn: Connection) {
12 | this.documents = new TextDocuments(TextDocument);
13 | this.documents.listen(conn);
14 | }
15 |
16 | getDocument(uri: string) {
17 | return this.documents.get(uri);
18 | }
19 |
20 | getAllDocuments() {
21 | return this.documents.all();
22 | }
23 |
24 | get onDidChangeContent() {
25 | return this.documents.onDidChangeContent;
26 | }
27 | get onDidClose() {
28 | return this.documents.onDidClose;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/server/src/services/typescriptService/vueSys.ts:
--------------------------------------------------------------------------------
1 | import { parseVueScript } from './preprocess';
2 | import type ts from 'typescript';
3 | import { isVirtualVueFile } from './util';
4 | import { RuntimeLibrary } from '../dependencyService';
5 |
6 | export function getVueSys(tsModule: RuntimeLibrary['typescript'], scriptFileNameSet: Set) {
7 | /**
8 | * This part is only accessed by TS module resolution
9 | */
10 | const vueSys: ts.System = {
11 | ...tsModule.sys,
12 | fileExists(path: string) {
13 | if (isVirtualVueFile(path, scriptFileNameSet)) {
14 | return tsModule.sys.fileExists(path.slice(0, -'.ts'.length));
15 | }
16 | return tsModule.sys.fileExists(path);
17 | },
18 | readFile(path, encoding) {
19 | if (isVirtualVueFile(path, scriptFileNameSet)) {
20 | const fileText = tsModule.sys.readFile(path.slice(0, -'.ts'.length), encoding);
21 | return fileText ? parseVueScript(fileText) : fileText;
22 | }
23 | const fileText = tsModule.sys.readFile(path, encoding);
24 | return fileText;
25 | }
26 | };
27 |
28 | if (tsModule.sys.realpath) {
29 | const realpath = tsModule.sys.realpath;
30 | vueSys.realpath = function (path) {
31 | if (isVirtualVueFile(path, scriptFileNameSet)) {
32 | return realpath(path.slice(0, -'.ts'.length)) + '.ts';
33 | }
34 | return realpath(path);
35 | };
36 | }
37 |
38 | return vueSys;
39 | }
40 |
--------------------------------------------------------------------------------
/server/src/typing.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'eslint-plugin-vue';
2 | declare module 'parse-gitignore';
3 | declare module '@prettier/plugin-pug';
4 | declare module 'stylus';
5 |
--------------------------------------------------------------------------------
/server/src/utils/cancellationToken.ts:
--------------------------------------------------------------------------------
1 | import { RuntimeLibrary } from '../services/dependencyService';
2 | import { CancellationToken as TSCancellationToken } from 'typescript';
3 | import { CancellationTokenSource, CancellationToken as LSPCancellationToken } from 'vscode-languageserver';
4 |
5 | export interface VCancellationToken extends LSPCancellationToken {
6 | tsToken: TSCancellationToken;
7 | }
8 |
9 | export class VCancellationTokenSource extends CancellationTokenSource {
10 | get token(): VCancellationToken {
11 | const token = super.token as VCancellationToken;
12 | token.tsToken = {
13 | isCancellationRequested() {
14 | return token.isCancellationRequested;
15 | },
16 | throwIfCancellationRequested() {
17 | if (token.isCancellationRequested) {
18 | throw new Error('OperationCanceledException');
19 | }
20 | }
21 | };
22 | return token;
23 | }
24 | }
25 |
26 | export function isVCancellationRequested(token?: VCancellationToken) {
27 | return new Promise(resolve => {
28 | if (!token) {
29 | resolve(false);
30 | } else {
31 | setImmediate(() => resolve(token.isCancellationRequested));
32 | }
33 | });
34 | }
35 |
--------------------------------------------------------------------------------
/server/src/utils/sleep.ts:
--------------------------------------------------------------------------------
1 | export function sleep(ms: number) {
2 | return new Promise(resolve => {
3 | setTimeout(resolve, ms);
4 | });
5 | }
6 |
--------------------------------------------------------------------------------
/server/src/utils/workspace.ts:
--------------------------------------------------------------------------------
1 | import ts from 'typescript';
2 |
3 | export function findConfigFile(findPath: string, configName: string) {
4 | return ts.findConfigFile(findPath, ts.sys.fileExists, configName);
5 | }
6 |
7 | export function requireUncached(module: string) {
8 | delete require.cache[require.resolve(module)];
9 | return require(module);
10 | }
11 |
--------------------------------------------------------------------------------
/server/src/vueServerMain.ts:
--------------------------------------------------------------------------------
1 | import { createConnection, InitializeParams, InitializeResult } from 'vscode-languageserver/node';
2 | import { VLS } from './services/vls';
3 |
4 | const connection = process.argv.length <= 2 ? createConnection(process.stdin, process.stdout) : createConnection();
5 |
6 | console.log = (...args: any[]) => connection.console.log(args.join(' '));
7 | console.error = (...args: any[]) => connection.console.error(args.join(' '));
8 |
9 | const vls = new VLS(connection);
10 | connection.onInitialize(
11 | async (params: InitializeParams): Promise => {
12 | await vls.init(params);
13 |
14 | console.log('Vetur initialized');
15 |
16 | return {
17 | capabilities: vls.capabilities
18 | };
19 | }
20 | );
21 |
22 | vls.listen();
23 |
--------------------------------------------------------------------------------
/server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.options.json",
3 | "compilerOptions": {
4 | "composite": true,
5 | "incremental": true,
6 | "outDir": "./dist",
7 | "tsBuildInfoFile": "./typings/tsconfig.tsbuildinfo",
8 | "rootDir": "src",
9 |
10 | "lib": ["es2015", "es2016.array.include"],
11 | // Most classes in VLS are asynchronously initialized
12 | "strictPropertyInitialization": false
13 | },
14 | "include": [
15 | "src"
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/server/tsconfig.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "./dist-test",
5 | "tsBuildInfoFile": "./dist-test/tsconfig.tsbuildinfo",
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/syntaxes/markdown-vue.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "markdown.vue.codeblock",
3 | "fileTypes": [],
4 | "injectionSelector": "L:text.html.markdown",
5 | "patterns": [
6 | {
7 | "include": "#vue-code-block"
8 | }
9 | ],
10 | "repository": {
11 | "vue-code-block": {
12 | "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(vue)(\\s+[^`~]*)?$)",
13 | "name": "markup.fenced_code.block.markdown",
14 | "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
15 | "beginCaptures": {
16 | "3": {
17 | "name": "punctuation.definition.markdown"
18 | },
19 | "5": {
20 | "name": "fenced_code.block.language"
21 | },
22 | "6": {
23 | "name": "fenced_code.block.language.attributes"
24 | }
25 | },
26 | "endCaptures": {
27 | "3": {
28 | "name": "punctuation.definition.markdown"
29 | }
30 | },
31 | "patterns": [
32 | {
33 | "begin": "(^|\\G)(\\s*)(.*)",
34 | "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
35 | "contentName": "meta.embedded.block.vue",
36 | "patterns": [
37 | {
38 | "include": "source.vue"
39 | }
40 | ]
41 | }
42 | ]
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/syntaxes/pug/directives.YAML:
--------------------------------------------------------------------------------
1 | # [PackageDev] target_format: plist, ext: tmLanguage
2 | scopeName: vue.pug.directives
3 | injectionSelector: "L:meta.tag.other -text.html.vue-html"
4 | patterns:
5 | - include: 'source.vue#vue-directives'
6 |
--------------------------------------------------------------------------------
/syntaxes/pug/directives.tmLanguage.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "vue.pug.directives",
3 | "injectionSelector": "L:meta.tag.other -text.html.vue-html",
4 | "patterns": [
5 | {
6 | "include": "source.vue#vue-directives"
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/syntaxes/pug/interpolations.YAML:
--------------------------------------------------------------------------------
1 | # [PackageDev] target_format: plist, ext: tmLanguage
2 | scopeName: vue.pug.interpolations
3 | injectionSelector: "L:text.pug"
4 | patterns:
5 | - include: source.vue#vue-interpolations
6 |
--------------------------------------------------------------------------------
/syntaxes/pug/interpolations.tmLanguage.json:
--------------------------------------------------------------------------------
1 | {
2 | "scopeName": "vue.pug.interpolations",
3 | "injectionSelector": "L:text.pug",
4 | "patterns": [
5 | {
6 | "include": "source.vue#vue-interpolations"
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/test/componentData/data-dir/User/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "update.mode": "none"
3 | }
4 |
--------------------------------------------------------------------------------
/test/componentData/features/beforeAll/beforeAll.test.ts:
--------------------------------------------------------------------------------
1 | import { activateLS } from '../../../editorHelper';
2 |
3 | before(async () => {
4 | await activateLS();
5 | });
6 |
--------------------------------------------------------------------------------
/test/componentData/fixture/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "vetur.experimental.templateInterpolationService": true
3 | }
4 |
--------------------------------------------------------------------------------
/test/componentData/fixture/attributes.json:
--------------------------------------------------------------------------------
1 | {
2 | "foo-tag/error": {
3 | "description": "Custom error"
4 | },
5 | "foo-tag/foo-attr": {
6 | "description": "An foo-attr description"
7 | },
8 | "handle-foo": {
9 | "type": "event",
10 | "documentation": "You gotta handle foo"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/test/componentData/fixture/beforeAll.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/componentData/fixture/completion/Element.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/test/componentData/fixture/completion/Event.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/test/componentData/fixture/completion/Link.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <
5 |
6 |
7 |
--------------------------------------------------------------------------------
/test/componentData/fixture/completion/Quasar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
--------------------------------------------------------------------------------
/test/componentData/fixture/completion/VueRouter.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test/componentData/fixture/completion/WorkspaceCustomTags.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/test/componentData/fixture/hover/Element.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
--------------------------------------------------------------------------------
/test/componentData/fixture/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "quasar": "^1.12.13",
4 | "vue": "^2.6.11",
5 | "vue-router": "3.3.4"
6 | },
7 | "devDependencies": {
8 | "element-ui": "^2.13.2"
9 | },
10 | "vetur": {
11 | "attributes": "./attributes.json",
12 | "tags": "./tags.json"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/test/componentData/fixture/tags.json:
--------------------------------------------------------------------------------
1 | {
2 | "foo-tag": {
3 | "description": "A foo tag",
4 | "attributes": ["error", "foo-attr", "handle-foo"]
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/test/componentData/index.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import Mocha from 'mocha';
3 | import glob from 'glob';
4 |
5 | export function run(): Promise {
6 | const args = {};
7 |
8 | Object.keys(process.env)
9 | .filter(k => k.startsWith('MOCHA_'))
10 | .forEach(k => {
11 | args[k.slice('MOCHA_'.length)] = process.env[k];
12 | });
13 |
14 | const mocha = new Mocha({
15 | ui: 'bdd',
16 | timeout: 100000,
17 | color: true,
18 | ...args
19 | });
20 |
21 | const testsRoot = __dirname;
22 |
23 | return new Promise((c, e) => {
24 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
25 | if (err) {
26 | return e(err);
27 | }
28 |
29 | // Add files to the test suite
30 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
31 |
32 | try {
33 | // Run the mocha test
34 | mocha.run(failures => {
35 | if (failures > 0) {
36 | e(new Error(`${failures} tests failed.`));
37 | } else {
38 | c();
39 | }
40 | });
41 | } catch (err) {
42 | e(err);
43 | }
44 | });
45 | });
46 | }
47 |
--------------------------------------------------------------------------------
/test/componentData/path.ts:
--------------------------------------------------------------------------------
1 | import { Uri } from 'vscode';
2 | import { resolve } from 'path';
3 |
4 | export const getDocPath = (p: string) => {
5 | return resolve(__dirname, `../../../test/componentData/fixture`, p);
6 | };
7 | export const getDocUri = (p: string) => {
8 | return Uri.file(getDocPath(p));
9 | };
10 |
--------------------------------------------------------------------------------
/test/definitionHelper.ts:
--------------------------------------------------------------------------------
1 | import assert from 'assert';
2 | import vscode from 'vscode';
3 | import { showFile } from './editorHelper';
4 |
5 | export async function testDefinition(docUri: vscode.Uri, position: vscode.Position, expectedLocation: vscode.Location) {
6 | await showFile(docUri);
7 |
8 | const result = (await vscode.commands.executeCommand(
9 | 'vscode.executeDefinitionProvider',
10 | docUri,
11 | position
12 | )) as vscode.Location[];
13 |
14 | assert.ok(result[0].range.isEqual(expectedLocation.range));
15 | assert.equal(result[0].uri.fsPath, expectedLocation.uri.fsPath);
16 | }
17 |
--------------------------------------------------------------------------------
/test/editorHelper.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 | import type { BaseLanguageClient } from 'vscode-languageclient';
3 |
4 | const EXT_IDENTIFIER = 'octref.vetur';
5 | const ext = vscode.extensions.getExtension(EXT_IDENTIFIER);
6 | /**
7 | * Activate Extension and open a Vue file to make sure LS is running
8 | */
9 | export async function activateLS() {
10 | try {
11 | await ext!.activate();
12 | } catch (err) {
13 | console.error(err);
14 | console.log(`Failed to activate ${EXT_IDENTIFIER}`);
15 | process.exit(1);
16 | }
17 | }
18 |
19 | export async function showFile(docUri: vscode.Uri) {
20 | const doc = await vscode.workspace.openTextDocument(docUri);
21 | return await vscode.window.showTextDocument(doc);
22 | }
23 |
24 | export async function setEditorContent(editor: vscode.TextEditor, content: string): Promise {
25 | const doc = editor.document;
26 | const all = new vscode.Range(doc.positionAt(0), doc.positionAt(doc.getText().length));
27 | return editor.edit(eb => eb.replace(all, content));
28 | }
29 |
30 | export const sendLSRequest: BaseLanguageClient['sendRequest'] = (...args: any[]) => ext!.exports.sendRequest(...args);
31 |
--------------------------------------------------------------------------------
/test/grammar/data-dir/User/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "update.mode": "none"
3 | }
4 |
--------------------------------------------------------------------------------
/test/grammar/fixture/Functional.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Text
4 |
8 |
9 |
10 |
{{test.case()}}
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/grammar/fixture/Html.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Text
4 |
8 |
9 |
10 |
{{test.case()}}
11 |
12 |
13 |
14 |
15 |
click me
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/test/grammar/fixture/Issue1465.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/test/grammar/fixture/PascalCase.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/test/grammar/fixture/Pug.vue:
--------------------------------------------------------------------------------
1 |
2 | .pug
3 | .normal-pug(attribute="test") Text
4 |
5 | .normal-pug-multi(attribute="test")
6 | .test Text
7 | | Test 2
8 |
9 | .vue-directive(v-if="test")
10 |
11 | .vue-directive-2(:attr="test()")
12 |
13 | .vue-interpolation {{test.case() + 'concatenation'}}
14 |
15 | .single-quote(v-if='test')
16 |
17 | .pug.javascript(:attr="i + will + 'concat' + this + string")
18 |
19 | .issue#1139 #[b.large foo] bar
20 |
21 | .v-slot(v-slot:foo="bar")
22 |
23 | .v-slot.shorthand(#foo="bar")
24 |
25 |
--------------------------------------------------------------------------------
/test/grammar/fixture/SingleLine.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/test/grammar/fixture/SugarSS.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/grammar/fixture/TemplateTag.vue:
--------------------------------------------------------------------------------
1 |
2 | Test
5 |
6 |
7 |
--------------------------------------------------------------------------------
/test/grammar/fixture/embedded.md:
--------------------------------------------------------------------------------
1 | ```vue
2 |
3 |
4 |
5 |
10 | ```
--------------------------------------------------------------------------------
/test/grammar/index.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import Mocha from 'mocha';
3 | import glob from 'glob';
4 |
5 | export function run(): Promise {
6 | const args = {};
7 |
8 | Object.keys(process.env)
9 | .filter(k => k.startsWith('MOCHA_'))
10 | .forEach(k => {
11 | args[k.slice('MOCHA_'.length)] = process.env[k];
12 | });
13 |
14 | const mocha = new Mocha({
15 | ui: 'bdd',
16 | timeout: 100000,
17 | color: true,
18 | ...args
19 | });
20 |
21 | const testsRoot = __dirname;
22 |
23 | return new Promise((c, e) => {
24 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
25 | if (err) {
26 | return e(err);
27 | }
28 |
29 | // Add files to the test suite
30 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
31 |
32 | try {
33 | // Run the mocha test
34 | mocha.run(failures => {
35 | if (failures > 0) {
36 | e(new Error(`${failures} tests failed.`));
37 | } else {
38 | c();
39 | }
40 | });
41 | } catch (err) {
42 | e(err);
43 | }
44 | });
45 | });
46 | }
47 |
--------------------------------------------------------------------------------
/test/hoverHelper.ts:
--------------------------------------------------------------------------------
1 | import vscode, { MarkdownString, MarkedString } from 'vscode';
2 | import assert from 'assert';
3 | import { showFile } from './editorHelper';
4 |
5 | export async function testHover(docUri: vscode.Uri, position: vscode.Position, expectedHover: vscode.Hover) {
6 | await showFile(docUri);
7 |
8 | const result = (await vscode.commands.executeCommand(
9 | 'vscode.executeHoverProvider',
10 | docUri,
11 | position
12 | )) as vscode.Hover[];
13 |
14 | if (!result[0]) {
15 | throw Error('Hover failed');
16 | }
17 |
18 | const contents = result[0].contents;
19 | contents.forEach((c, i) => {
20 | const actualContent = markedStringToSTring(c);
21 | const expectedContent = markedStringToSTring(expectedHover.contents[i]);
22 | assert.ok(actualContent.startsWith(expectedContent), `Expecting\n${expectedContent}\nGot\n${actualContent}`);
23 | });
24 |
25 | if (result[0] && result[0].range) {
26 | assert.ok(result[0].range!.isEqual(expectedHover.range!));
27 | }
28 | }
29 |
30 | function markedStringToSTring(s: MarkdownString | MarkedString) {
31 | return typeof s === 'string' ? s : s.value;
32 | }
33 |
--------------------------------------------------------------------------------
/test/interpolation/data-dir/User/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "update.mode": "none"
3 | }
4 |
--------------------------------------------------------------------------------
/test/interpolation/features/beforeAll/beforeAll.test.ts:
--------------------------------------------------------------------------------
1 | import { activateLS } from '../../../editorHelper';
2 |
3 | before(async () => {
4 | await activateLS();
5 | });
6 |
--------------------------------------------------------------------------------
/test/interpolation/features/definition/basic.test.ts:
--------------------------------------------------------------------------------
1 | import { position, sameLineLocation } from '../../../util';
2 | import { getDocUri } from '../../path';
3 | import { testDefinition } from '../../../definitionHelper';
4 |
5 | describe('Should find definition in html template', () => {
6 | const docUri = getDocUri('definition/Basic.vue');
7 |
8 | it('finds definition for child tag', async () => {
9 | const tagUri = getDocUri('definition/Child.vue');
10 | await testDefinition(docUri, position(2, 5), sameLineLocation(tagUri, 0, 0, 0));
11 | });
12 |
13 | it('finds definition for test-bar tag', async () => {
14 | const tagUri = getDocUri('definition/TestBar.vue');
15 | await testDefinition(docUri, position(3, 5), sameLineLocation(tagUri, 0, 0, 0));
16 | });
17 |
18 | it('finds definition for TestBar tag', async () => {
19 | const tagUri = getDocUri('definition/TestBar.vue');
20 | await testDefinition(docUri, position(4, 5), sameLineLocation(tagUri, 0, 0, 0));
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/test/interpolation/features/definition/class.test.ts:
--------------------------------------------------------------------------------
1 | import { position, sameLineLocation } from '../../../util';
2 | import { getDocUri } from '../../path';
3 | import { testDefinition } from '../../../definitionHelper';
4 |
5 | describe('Should find definition for vue-class-component components', () => {
6 | const parentUri = getDocUri('definition/classComponent/Parent.vue');
7 |
8 | it('finds definition for opening tag in ', async () => {
9 | const tagUri = getDocUri('definition/classComponent/Child.vue');
10 | await testDefinition(parentUri, position(2, 5), sameLineLocation(tagUri, 0, 0, 0));
11 | });
12 |
13 | it('finds definition for closing tag in ', async () => {
14 | const tagUri = getDocUri('definition/classComponent/Child.vue');
15 | await testDefinition(parentUri, position(2, 13), sameLineLocation(tagUri, 0, 0, 0));
16 | });
17 |
18 | it('finds definition for self-closing tag ', async () => {
19 | const tagUri = getDocUri('definition/classComponent/Child.vue');
20 | await testDefinition(parentUri, position(3, 5), sameLineLocation(tagUri, 0, 0, 0));
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/test/interpolation/features/definition/pug.test.ts:
--------------------------------------------------------------------------------
1 | import { position, sameLineLocation } from '../../../util';
2 | import { getDocUri } from '../../path';
3 | import { testDefinition } from '../../../definitionHelper';
4 |
5 | describe('Should find definition in pug template', () => {
6 | const docUri = getDocUri('definition/BasicPug.vue');
7 |
8 | it('finds definition for child tag', async () => {
9 | const tagUri = getDocUri('definition/Child.vue');
10 | await testDefinition(docUri, position(2, 5), sameLineLocation(tagUri, 0, 0, 0));
11 | });
12 |
13 | it('finds definition for test-bar tag', async () => {
14 | const tagUri = getDocUri('definition/TestBar.vue');
15 | await testDefinition(docUri, position(3, 5), sameLineLocation(tagUri, 0, 0, 0));
16 | });
17 |
18 | it('finds definition for TestBar tag', async () => {
19 | const tagUri = getDocUri('definition/TestBar.vue');
20 | await testDefinition(docUri, position(4, 5), sameLineLocation(tagUri, 0, 0, 0));
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/test/interpolation/features/hover/basic.test.ts:
--------------------------------------------------------------------------------
1 | import { testHover } from '../../../hoverHelper';
2 | import { position, sameLineRange } from '../../../util';
3 | import { getDocUri } from '../../path';
4 |
5 | describe('Should do hover interpolation for ', () => {
6 | const docUri = getDocUri('hover/Basic.vue');
7 |
8 | it('shows hover for msg in mustache', async () => {
9 | await testHover(docUri, position(2, 11), {
10 | contents: ['```ts\n(property) msg: string\n```'],
11 | range: sameLineRange(2, 10, 13)
12 | });
13 | });
14 |
15 | it('shows hover for v-for variable', async () => {
16 | await testHover(docUri, position(5, 20), {
17 | contents: ['```ts\n(parameter) item: number\n```'],
18 | range: sameLineRange(5, 18, 22)
19 | });
20 | });
21 |
22 | it('shows hover for v-for variable on readonly array', async () => {
23 | await testHover(docUri, position(10, 20), {
24 | contents: ['```ts\n(parameter) item: string\n```'],
25 | range: sameLineRange(10, 18, 22)
26 | });
27 | });
28 | });
29 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "vetur.experimental.templateInterpolationService": true,
3 | "vetur.validation.templateProps": true
4 | }
--------------------------------------------------------------------------------
/test/interpolation/fixture/beforeAll.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ }}
4 | {{ obj. }}
5 |
6 |
7 |
8 |
58 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | <
8 |
9 |
10 |
11 |
55 |
56 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/TestComp.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ bar }}
3 |
4 |
5 |
21 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/classComponent/Child.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ }}
4 | {{ obj. }}
5 |
6 |
7 |
8 |
54 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/classComponent/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | <
7 |
8 |
9 |
10 |
50 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/propertyDecorator/Child.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ }}
4 | {{ obj. }}
5 |
6 |
7 |
8 |
80 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/completion/propertyDecorator/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | <
7 |
8 |
9 |
10 |
46 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/definition/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
21 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/definition/BasicPug.vue:
--------------------------------------------------------------------------------
1 |
2 | div
3 | child(foo="bar")
4 | test-bar
5 | TestBar
6 |
7 |
8 |
20 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/definition/Child.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ foo }}
3 |
4 |
5 |
12 |
13 |
16 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/definition/TestBar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/definition/classComponent/Child.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/definition/classComponent/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
20 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/class-in-template.vue:
--------------------------------------------------------------------------------
1 |
2 | Test
3 |
4 |
5 |
8 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/directive-dynamic-argument.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
26 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/directive.vue:
--------------------------------------------------------------------------------
1 |
2 | v-show test
3 |
4 |
5 |
16 |
17 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/expression.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ messaage }}
3 |
4 |
5 |
16 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/external-script.ts:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 |
3 | export default Vue.extend({
4 | data() {
5 | return {
6 | message: 'Hello'
7 | };
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/external-script.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ messaage }}
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/filter.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ price | comma }}
4 |
{{ messaage | capitalize | foo(...test) }}
5 |
6 |
7 |
8 |
20 |
21 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/hyphen-attrs.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
16 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/issue-1745-duplicate-event-with-modifiers.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/issue-2254.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
55 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/issue-2258.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{item.name}}
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/issue-3107.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
17 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/jsdocs-type-check.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ onlyNumber(msg) }}
4 |
5 |
6 |
7 |
22 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/member-modifiers.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{ a }}
5 |
{{ b }}
6 |
{{ c }}
7 |
8 |
9 |
{{ child.a }}
10 |
{{ child.b }}
11 |
{{ child.c }}
12 |
13 |
14 |
15 |
34 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/no-implicit-any-parameters.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
18 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/no-implicit-any-v-for-array.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | Test {{num.q.toString()}}
8 |
9 |
10 |
11 |
12 |
28 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/object-literal.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Hello
8 |
9 |
Literal Keys
10 |
11 |
12 |
13 |
24 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/optional-in-template.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ a?.b ?? '1' }}
3 |
4 |
5 |
18 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propTypeValidation/ArrayPropsChild.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propTypeValidation/JSChild.vue:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propTypeValidation/ParentRight.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propTypeValidation/ParentWrong.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propTypeValidation/TSChild.vue:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propsValidation/array-props-child.vue:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propsValidation/class-child.vue:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propsValidation/object-validator-props-child.vue:
--------------------------------------------------------------------------------
1 |
43 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propsValidation/parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
40 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propsValidation/pass-parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
29 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/propsValidation/simple-validator-props-child.vue:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/style-in-template.vue:
--------------------------------------------------------------------------------
1 |
2 | Test
3 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/template-literal.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/template-position.vue:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 | {{ message + foo }}
15 |
16 |
17 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/trivia.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 | {{ test+true }}
8 |
9 |
10 |
11 |
24 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/v-for.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ item + i }}
4 |
5 | {{ value + key + i }}
6 | {{ notExists }}
7 |
8 |
9 | {{ i }}
10 |
11 |
12 | {{index}} | {{ n }}
13 |
14 |
15 |
16 |
17 |
32 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/v-if-and-v-for.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ assert(d) }}
5 |
6 |
7 |
8 |
9 |
24 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/v-if-narrowing.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ assert(node) }}
5 |
6 |
7 | {{ assert(node) }}
8 |
9 |
10 | {{ assert(node) }}
11 |
12 |
13 | {{ assert(node) }}
14 |
15 |
16 |
17 |
18 |
47 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/v-on.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
39 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/v-slot-scope.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ a.foo }}
6 |
7 |
8 |
9 |
10 |
11 |
16 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/diagnostics/v-slot.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ a + b + c }}
4 |
5 |
6 |
7 |
14 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/hover/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |
6 | -
7 | {{ item }}
8 |
9 |
10 |
11 | -
12 | {{ item }}
13 |
14 |
15 |
16 |
17 |
18 |
29 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "vue": "^2.6.11",
4 | "vue-class-component": "^7.2.5",
5 | "vue-property-decorator": "^9.0.0",
6 | "vue-router": "^3.3.4",
7 | "vuex": "^3.5.1"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/interpolation/fixture/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "strict": true,
4 | "lib": ["dom", "es5"],
5 | "experimentalDecorators": true
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/test/interpolation/index.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import Mocha from 'mocha';
3 | import glob from 'glob';
4 |
5 | export function run(): Promise {
6 | const args = {};
7 |
8 | Object.keys(process.env)
9 | .filter(k => k.startsWith('MOCHA_'))
10 | .forEach(k => {
11 | args[k.slice('MOCHA_'.length)] = process.env[k];
12 | });
13 |
14 | const mocha = new Mocha({
15 | ui: 'bdd',
16 | timeout: 100000,
17 | color: true,
18 | ...args
19 | });
20 |
21 | const testsRoot = __dirname;
22 |
23 | return new Promise((c, e) => {
24 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
25 | if (err) {
26 | return e(err);
27 | }
28 |
29 | // Add files to the test suite
30 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
31 |
32 | try {
33 | // Run the mocha test
34 | mocha.run(failures => {
35 | if (failures > 0) {
36 | e(new Error(`${failures} tests failed.`));
37 | } else {
38 | c();
39 | }
40 | });
41 | } catch (err) {
42 | e(err);
43 | }
44 | });
45 | });
46 | }
47 |
--------------------------------------------------------------------------------
/test/interpolation/path.ts:
--------------------------------------------------------------------------------
1 | import { Uri } from 'vscode';
2 | import { resolve } from 'path';
3 |
4 | export const getDocPath = (p: string) => {
5 | return Uri.file(resolve(__dirname, `../../../test/interpolation/fixture`, p)).fsPath;
6 | };
7 | export const getDocUri = (p: string) => {
8 | return Uri.file(getDocPath(p));
9 | };
10 |
--------------------------------------------------------------------------------
/test/lsp/data-dir/User/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "update.mode": "none",
3 | "vetur.useWorkspaceDependencies": true
4 | }
5 |
--------------------------------------------------------------------------------
/test/lsp/features/beforeAll/beforeAll.test.ts:
--------------------------------------------------------------------------------
1 | import { activateLS } from '../../../editorHelper';
2 |
3 | before(async () => {
4 | await activateLS();
5 | });
6 |
--------------------------------------------------------------------------------
/test/lsp/features/completion/emmet.test.ts:
--------------------------------------------------------------------------------
1 | import { position } from '../../../util';
2 | import { testCompletion } from '../../../completionHelper';
3 | import { getDocUri } from '../../path';
4 |
5 | describe('Should do emmet in template region', () => {
6 | const basicUri = getDocUri('completion/template/Emmet.vue');
7 |
8 | it('Should do emmet right after {{ }}', async () => {
9 | await testCompletion(basicUri, position(3, 5), [
10 | {
11 | label: 'p',
12 | detail: 'Emmet Abbreviation',
13 | documentationStart: '|
'
14 | }
15 | ]);
16 | });
17 |
18 | it('Should do emmet inside style="|"', async () => {
19 | await testCompletion(basicUri, position(1, 15), [
20 | {
21 | label: 'padding: ;',
22 | detail: 'Emmet Abbreviation',
23 | documentationStart: 'padding: |;'
24 | }
25 | ]);
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/test/lsp/features/completion/pathCompletion.test.ts:
--------------------------------------------------------------------------------
1 | import { position } from '../../../util';
2 | import { testCompletion } from '../../../completionHelper';
3 | import { CompletionItemKind } from 'vscode';
4 | import { getDocUri } from '../../path';
5 |
6 | describe('Should do path completion for import', () => {
7 | const scriptDocUri = getDocUri('completion/script/PathCompletion.vue');
8 |
9 | it('completes local file names when importing', async () => {
10 | await testCompletion(scriptDocUri, position(5, 10), [
11 | {
12 | label: 'Basic',
13 | kind: CompletionItemKind.File,
14 | detail: 'Basic.vue'
15 | },
16 | {
17 | label: 'Item',
18 | kind: CompletionItemKind.File,
19 | detail: 'Item.vue'
20 | }
21 | ]);
22 | });
23 |
24 | it('completes folder names', async () => {
25 | await testCompletion(scriptDocUri, position(6, 11), [
26 | {
27 | label: 'script',
28 | kind: CompletionItemKind.Folder
29 | },
30 | {
31 | label: 'style',
32 | kind: CompletionItemKind.Folder
33 | },
34 | {
35 | label: 'template',
36 | kind: CompletionItemKind.Folder
37 | }
38 | ]);
39 | });
40 | });
41 |
--------------------------------------------------------------------------------
/test/lsp/features/definition/basic.test.ts:
--------------------------------------------------------------------------------
1 | import { testDefinition } from '../../../definitionHelper';
2 | import { location, position, sameLineLocation } from '../../../util';
3 | import { getDocUri } from '../../path';
4 |
5 | describe('Should find definition', () => {
6 | const docUri = getDocUri('definition/Basic.vue');
7 |
8 | it('finds definition for this.msg', async () => {
9 | await testDefinition(docUri, position(32, 23), sameLineLocation(docUri, 22, 6, 9));
10 | });
11 |
12 | it('finds definition for lodash', async () => {
13 | const lodashDtsUri = getDocUri('node_modules/@types/lodash/index.d.ts');
14 | await testDefinition(docUri, position(16, 12), sameLineLocation(lodashDtsUri, 246, 12, 13));
15 | });
16 |
17 | it('finds definition for Vue#data', async () => {
18 | const vueOptionsDtsUri = getDocUri('node_modules/vue/types/options.d.ts');
19 | await testDefinition(docUri, position(20, 2), sameLineLocation(vueOptionsDtsUri, 73, 2, 6));
20 | });
21 |
22 | it('finds definition for imported Vue files', async () => {
23 | const itemUri = getDocUri('definition/Basic.Item.vue');
24 | await testDefinition(docUri, position(17, 7), location(itemUri, 5, 0, 7, 1));
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/test/lsp/features/diagnostics/Deprecated.test.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 | import { DiagnosticTag } from 'vscode-languageclient';
3 | import { sameLineRange } from '../../../util';
4 | import { testDiagnostics } from '../../../diagnosticHelper';
5 | import { getDocUri } from '../../path';
6 |
7 | describe('Should find diagnostics for deprecated code', () => {
8 | const docUri = getDocUri('diagnostics/Deprecated.vue');
9 |
10 | it('shows diagnostic errors for deprecated function', async () => {
11 | const expectedDiagnostics: vscode.Diagnostic[] = [
12 | {
13 | severity: vscode.DiagnosticSeverity.Hint,
14 | message: "'createReturn' is deprecated",
15 | range: sameLineRange(2, 3, 15),
16 | tags: [DiagnosticTag.Deprecated]
17 | }
18 | ];
19 |
20 | await testDiagnostics(docUri, expectedDiagnostics);
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/test/lsp/features/diagnostics/eslint.test.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 | import { sameLineRange } from '../../../util';
3 | import { testDiagnostics } from '../../../diagnosticHelper';
4 | import { getDocUri } from '../../path';
5 |
6 | describe('Should find diagnostics using eslint-plugin-vue', () => {
7 | const docUri = getDocUri('diagnostics/ESLint.vue');
8 |
9 | it('shows diagnostic errors for template errors', async () => {
10 | const expectedDiagnostics: vscode.Diagnostic[] = [
11 | {
12 | severity: vscode.DiagnosticSeverity.Error,
13 | message: "[vue/require-v-for-key]\nElements in iteration expect to have 'v-bind:key' directives.",
14 | range: sameLineRange(2, 4, 23),
15 | source: 'eslint-plugin-vue'
16 | },
17 | {
18 | severity: vscode.DiagnosticSeverity.Error,
19 | message: "[vue/no-unused-vars]\n'i' is defined but never used.",
20 | range: sameLineRange(2, 15, 16),
21 | source: 'eslint-plugin-vue'
22 | },
23 | {
24 | severity: vscode.DiagnosticSeverity.Error,
25 | message: '[vue/no-multiple-template-root]\nThe template root requires exactly one element.',
26 | range: sameLineRange(6, 2, 13),
27 | source: 'eslint-plugin-vue'
28 | }
29 | ];
30 |
31 | await testDiagnostics(docUri, expectedDiagnostics);
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/test/lsp/features/diagnostics/issue-1336.test.ts:
--------------------------------------------------------------------------------
1 | import { testNoDiagnostics } from '../../../diagnosticHelper';
2 | import { getDocUri } from '../../path';
3 |
4 | describe('Should find no error when no root template element', () => {
5 | const docUri = getDocUri('diagnostics/issue-1336.vue');
6 |
7 | it('shows no diagnostics error without root template element area', async () => {
8 | await testNoDiagnostics(docUri);
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/test/lsp/features/diagnostics/noScriptRegion.test.ts:
--------------------------------------------------------------------------------
1 | import { testNoDiagnostics } from '../../../diagnosticHelper';
2 | import { getDocUri } from '../../path';
3 |
4 | describe('Should find no error when
14 |
15 |
23 |
24 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/autoImport/defineInOneLine.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
24 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/autoImport/kebab-case.vue:
--------------------------------------------------------------------------------
1 |
2 | foo
3 |
4 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/autoImport/noDefineComponents.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | <
4 |
5 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/autoImport/sameComponentName.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <
5 |
6 |
7 |
8 |
18 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/script/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
24 |
25 |
27 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/script/Hyphen.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/script/Item.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/script/PathCompletion.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/script/issue-2300.vue:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/script/kindModifiers.vue:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/style/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
16 |
17 |
22 |
23 |
28 |
29 |
34 |
35 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/style/Double.vue:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/style/SassEmmet.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
17 |
26 |
27 |
30 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/Emmet.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ foo }}
4 | p
5 |
6 |
7 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/Item.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/childComponent/Child1775.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/childComponent/Child2143.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/childComponent/ChildComp.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
21 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/childComponent/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/childComponent/Parent1775.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/template/childComponent/Parent2143.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/vue/Custom.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
15 |
16 | <
17 |
18 |
--------------------------------------------------------------------------------
/test/lsp/fixture/completion/vue/Scaffold.vue:
--------------------------------------------------------------------------------
1 | <
2 |
--------------------------------------------------------------------------------
/test/lsp/fixture/components/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
31 |
--------------------------------------------------------------------------------
/test/lsp/fixture/components/Counter.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |

6 |
7 |
8 | {{ count }}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
38 |
39 |
56 |
--------------------------------------------------------------------------------
/test/lsp/fixture/components/Item.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/definition/Basic.Item.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/definition/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |

6 |
7 |
8 | {{ count }}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
38 |
39 |
56 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/.vitepress/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
30 |
31 |
36 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
30 |
31 |
36 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/Deprecated.vue:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/ESLint.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
33 |
34 |
51 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/Unused.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/issue-1336.vue:
--------------------------------------------------------------------------------
1 |
2 | hello world
3 |
4 |
5 |
6 | ` ``vue
7 |
8 |
9 | 1
10 | 2
11 |
12 |
13 | ` ``
14 |
15 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/noScriptRegion/ChildComp.vue:
--------------------------------------------------------------------------------
1 |
2 | No script region in this component
3 |
4 |
--------------------------------------------------------------------------------
/test/lsp/fixture/diagnostics/noScriptRegion/ParentComp.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/documentColor/Basic.vue:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/test/lsp/fixture/documentHighlight/Basic.Item.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/documentHighlight/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |

6 |
7 |
8 | {{ count }}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
39 |
40 |
57 |
--------------------------------------------------------------------------------
/test/lsp/fixture/documentLink/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/test/lsp/fixture/documentSymbol/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
15 |
16 |
21 |
22 |
--------------------------------------------------------------------------------
/test/lsp/fixture/external/Foo.pug:
--------------------------------------------------------------------------------
1 | div
2 |
--------------------------------------------------------------------------------
/test/lsp/fixture/external/Foo.ts:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 |
3 | export default Vue.extend({
4 | name: 'Foo'
5 | });
6 |
--------------------------------------------------------------------------------
/test/lsp/fixture/external/Foo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/Basic.Expected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
16 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
21 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/Pug.Expected.vue:
--------------------------------------------------------------------------------
1 |
2 | - var friends = 10;
3 |
4 | case friends
5 | when 0
6 | p you have no friends
7 | when 1
8 | p you have a friend
9 | default
10 | p you have #{friends} friends
11 |
12 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/Pug.vue:
--------------------------------------------------------------------------------
1 |
2 | - var friends =10
3 |
4 | case friends
5 | when 0
6 | p you have no friends
7 | when 1
8 | p you have a friend
9 | default
10 | p you have #{friends} friends
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/Sass.Expected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
16 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/Sass.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
18 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/TwoStylus.Expected.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/TwoStylus.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/VueHNUserView.Expected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | User : {{ user.id }}
5 |
6 |
17 |
18 | submissions
19 | |
20 | comments
21 |
22 |
23 |
24 | User not found.
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/VueHNUserView.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | User : {{ user.id }}
5 |
6 |
17 |
18 | submissions |
19 |
20 |
21 | comments
22 |
23 |
24 |
25 | User not found.
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/issue-2467.Expected.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/test/lsp/fixture/formatting/issue-2467.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/test/lsp/fixture/hover/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |

6 |
7 |
8 | {{ count }}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
39 |
40 |
57 |
--------------------------------------------------------------------------------
/test/lsp/fixture/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "buefy": "^0.8.16",
4 | "element-ui": "^2.4.5",
5 | "lodash": "^4.17.21",
6 | "quasar": "^1.0.0-beta.0",
7 | "vue": "^2.6.11",
8 | "vue-router": "^3.0.1",
9 | "vuetify": "^2.0.0",
10 | "vuex": "^3.0.1"
11 | },
12 | "devDependencies": {
13 | "@prettier/plugin-pug": "^1.8.1",
14 | "@types/lodash": "^4.14.77",
15 | "eslint": "^7.5.0",
16 | "eslint-plugin-vue": "^6.2.2",
17 | "prettier": "^2.1.2",
18 | "typescript": "^4.1.3"
19 | },
20 | "vetur": {
21 | "tags": "./tags.json"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/test/lsp/fixture/references/Basic.Item.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/references/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |

6 |
7 |
8 | {{ count }}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
39 |
40 |
57 |
--------------------------------------------------------------------------------
/test/lsp/fixture/renameFiles/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/renameFiles/Imported.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/test/lsp/fixture/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import Router from 'vue-router';
3 |
4 | Vue.use(Router);
5 |
6 | export default new Router({
7 | mode: 'hash',
8 | routes: [
9 | {
10 | path: '/'
11 | }
12 | ]
13 | });
14 |
--------------------------------------------------------------------------------
/test/lsp/fixture/semanticTokens/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/lsp/fixture/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import Vuex from 'vuex';
3 |
4 | Vue.use(Vuex);
5 |
6 | const store = new Vuex.Store({
7 | state: {},
8 | mutations: {},
9 | actions: {}
10 | });
11 |
12 | export default store;
13 |
--------------------------------------------------------------------------------
/test/lsp/fixture/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "strict": true,
6 | "noUnusedLocals": true,
7 | "noImplicitAny": true,
8 | "outDir": "dist",
9 | "sourceMap": true,
10 | "lib": [
11 | "es5", "es2015.collection", "es2015.promise", "dom", "es2016.array.include"
12 | ],
13 | "allowJs": true,
14 | "checkJs": true
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/lsp/index.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import Mocha from 'mocha';
3 | import glob from 'glob';
4 |
5 | export function run(): Promise {
6 | const args = {};
7 |
8 | Object.keys(process.env)
9 | .filter(k => k.startsWith('MOCHA_'))
10 | .forEach(k => {
11 | args[k.slice('MOCHA_'.length)] = process.env[k];
12 | });
13 |
14 | const mocha = new Mocha({
15 | ui: 'bdd',
16 | timeout: 100000,
17 | color: true,
18 | ...args
19 | });
20 |
21 | const testsRoot = __dirname;
22 |
23 | return new Promise((c, e) => {
24 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
25 | if (err) {
26 | return e(err);
27 | }
28 |
29 | // Add files to the test suite
30 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
31 |
32 | try {
33 | // Run the mocha test
34 | mocha.run(failures => {
35 | if (failures > 0) {
36 | e(new Error(`${failures} tests failed.`));
37 | } else {
38 | c();
39 | }
40 | });
41 | } catch (err) {
42 | e(err);
43 | }
44 | });
45 | });
46 | }
47 |
--------------------------------------------------------------------------------
/test/lsp/path.ts:
--------------------------------------------------------------------------------
1 | import { Uri } from 'vscode';
2 | import { resolve } from 'path';
3 |
4 | export const getDocPath = (p: string) => {
5 | return resolve(__dirname, `../../../test/lsp/fixture`, p);
6 | };
7 | export const getDocUri = (p: string) => {
8 | return Uri.file(getDocPath(p));
9 | };
10 |
--------------------------------------------------------------------------------
/test/monorepo/data-dir/User/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "update.mode": "none"
3 | }
4 |
--------------------------------------------------------------------------------
/test/monorepo/features/beforeAll/beforeAll.test.ts:
--------------------------------------------------------------------------------
1 | import { activateLS } from '../../../editorHelper';
2 |
3 | before(async () => {
4 | await activateLS();
5 | });
6 |
--------------------------------------------------------------------------------
/test/monorepo/features/completion/alias.test.ts:
--------------------------------------------------------------------------------
1 | import { position } from '../../../util';
2 | import { testCompletion } from '../../../completionHelper';
3 | import { getDocUri } from '../../path';
4 |
5 | describe('Should autocomplete for
4 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue2/components/AppSpinner.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue2/diagnostics/ESLint.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue2/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2015",
4 | "module": "esnext",
5 | "strict": true,
6 | "baseUrl": "./",
7 | "paths": {
8 | "@/*": ["components/*"]
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue2",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "vue": "^2.6.11"
6 | },
7 | "vetur": {
8 | "tags": "./tags.json"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue3/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue3",
3 | "version": "1.0.0",
4 | "devDependencies": {
5 | "vue": "^3.0.0"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue3/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue3/src/components/AppButton.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
25 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue3/src/data/test.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/packages/vue3/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2015",
4 | "module": "esnext",
5 | "strict": true,
6 | "moduleResolution": "node",
7 | "esModuleInterop": true,
8 | "resolveJsonModule": true,
9 | "allowSyntheticDefaultImports": true,
10 | "baseUrl": ".",
11 | "paths": {
12 | "@/*": [
13 | "src/*"
14 | ]
15 | },
16 | "lib": [
17 | "esnext",
18 | "dom",
19 | "dom.iterable",
20 | "scripthost"
21 | ]
22 | },
23 | "include": [
24 | "**/*.ts",
25 | "**/*.tsx",
26 | "**/*.vue",
27 | "**/*.ts",
28 | "**/*.tsx"
29 | ],
30 | "exclude": [
31 | "node_modules"
32 | ]
33 | }
34 |
--------------------------------------------------------------------------------
/test/monorepo/fixture/vetur.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | settings: {
3 | 'vetur.validation.templateProps': true
4 | },
5 | projects: [
6 | './packages/vue2',
7 | { root: './packages/vue3', tsconfig: './src/tsconfig.json', globalComponents: ['./src/components/**/*.vue'] }
8 | ]
9 | };
10 |
--------------------------------------------------------------------------------
/test/monorepo/index.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import Mocha from 'mocha';
3 | import glob from 'glob';
4 |
5 | export function run(): Promise {
6 | const args = {};
7 |
8 | Object.keys(process.env)
9 | .filter(k => k.startsWith('MOCHA_'))
10 | .forEach(k => {
11 | args[k.slice('MOCHA_'.length)] = process.env[k];
12 | });
13 |
14 | const mocha = new Mocha({
15 | ui: 'bdd',
16 | timeout: 100000,
17 | color: true,
18 | ...args
19 | });
20 |
21 | const testsRoot = __dirname;
22 |
23 | return new Promise((c, e) => {
24 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
25 | if (err) {
26 | return e(err);
27 | }
28 |
29 | // Add files to the test suite
30 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
31 |
32 | try {
33 | // Run the mocha test
34 | mocha.run(failures => {
35 | if (failures > 0) {
36 | e(new Error(`${failures} tests failed.`));
37 | } else {
38 | c();
39 | }
40 | });
41 | } catch (err) {
42 | e(err);
43 | }
44 | });
45 | });
46 | }
47 |
--------------------------------------------------------------------------------
/test/monorepo/path.ts:
--------------------------------------------------------------------------------
1 | import { Uri } from 'vscode';
2 | import { resolve } from 'path';
3 |
4 | export const getDocPath = (p: string) => {
5 | return resolve(__dirname, `../../../test/monorepo/fixture`, p);
6 | };
7 | export const getDocUri = (p: string) => {
8 | return Uri.file(getDocPath(p));
9 | };
10 |
--------------------------------------------------------------------------------
/test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.options.json",
3 | "compilerOptions": {
4 | "composite": true,
5 | "rootDir": "../",
6 | "outDir": "../dist-test",
7 | "tsBuildInfoFile": "../dist-test/tsconfig.tsbuildinfo",
8 |
9 | "noImplicitAny": false,
10 | "lib": ["es2015"]
11 | },
12 | "include": [
13 | "**/*.ts"
14 | ],
15 | "exclude": [
16 | "**/fixture"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/test/util.ts:
--------------------------------------------------------------------------------
1 | import vscode from 'vscode';
2 |
3 | export function position(line: number, char: number) {
4 | return new vscode.Position(line, char);
5 | }
6 | export function range(startLine: number, startChar: number, endLine: number, endChar: number) {
7 | return new vscode.Range(position(startLine, startChar), position(endLine, endChar));
8 | }
9 | export function sameLineRange(line: number, startChar: number, endChar: number) {
10 | return new vscode.Range(position(line, startChar), position(line, endChar));
11 | }
12 | export function location(uri: vscode.Uri, startLine: number, startChar: number, endLine: number, endChar: number) {
13 | return new vscode.Location(uri, range(startLine, startChar, endLine, endChar));
14 | }
15 | export function sameLineLocation(uri: vscode.Uri, line: number, startChar: number, endChar: number) {
16 | return new vscode.Location(uri, sameLineRange(line, startChar, endChar));
17 | }
18 | export function textEdit(range: vscode.Range, newText: string) {
19 | return new vscode.TextEdit(range, newText);
20 | }
21 | export function sleep(ms: number) {
22 | return new Promise(resolve => setTimeout(resolve, ms));
23 | }
24 |
--------------------------------------------------------------------------------
/test/vue3/data-dir/User/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "update.mode": "none"
3 | }
4 |
--------------------------------------------------------------------------------
/test/vue3/features/beforeAll/beforeAll.test.ts:
--------------------------------------------------------------------------------
1 | import { activateLS } from '../../../editorHelper';
2 |
3 | before(async () => {
4 | await activateLS();
5 | });
6 |
--------------------------------------------------------------------------------
/test/vue3/features/completion/basic.test.ts:
--------------------------------------------------------------------------------
1 | import { CompletionItemKind } from 'vscode';
2 | import { getDocUri } from '../../path';
3 | import { position } from '../../../util';
4 | import { testCompletion } from '../../../completionHelper';
5 |
6 | describe('Vue 3 integration test', () => {
7 | const fileUri = getDocUri('completion/Basic.vue');
8 |
9 | describe('Should complete Vue 3 options', () => {
10 | it('complete `setup`', async () => {
11 | await testCompletion(fileUri, position(6, 2), [
12 | {
13 | label: 'setup?',
14 | kind: CompletionItemKind.Field,
15 | insertText: 'setup'
16 | }
17 | ]);
18 | });
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/test/vue3/features/completion/interpolation.test.ts:
--------------------------------------------------------------------------------
1 | import { CompletionItem, CompletionItemKind, MarkdownString } from 'vscode';
2 | import { position } from '../../../util';
3 | import { testCompletion, testNoSuchCompletion } from '../../../completionHelper';
4 | import { getDocUri } from '../../path';
5 |
6 | describe('Should autocomplete interpolation for ', () => {
7 | const parentTemplateDocUri = getDocUri('completion/interpolation/Parent.vue');
8 |
9 | describe('Should complete emits', () => {
10 | it(`completes child component's emits`, async () => {
11 | await testCompletion(parentTemplateDocUri, position(1, 10), [
12 | {
13 | label: 'foo',
14 | kind: CompletionItemKind.Function,
15 | documentation: new MarkdownString('My foo').appendCodeblock(`foo: () => true`, 'js')
16 | }
17 | ]);
18 | });
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/test/vue3/features/completion/interpolationClassComponent.test.ts:
--------------------------------------------------------------------------------
1 | import { CompletionItem, CompletionItemKind, MarkdownString } from 'vscode';
2 | import { position } from '../../../util';
3 | import { getDocUri } from '../../path';
4 | import { testCompletion, testNoSuchCompletion } from '../../../completionHelper';
5 |
6 | describe('Should autocomplete interpolation for in class component', () => {
7 | const parentTemplateDocUri = getDocUri('completion/interpolation/classComponent/Parent.vue');
8 |
9 | describe('Should complete emits', () => {
10 | it(`completes child component's emits`, async () => {
11 | await testCompletion(parentTemplateDocUri, position(1, 16), [
12 | {
13 | label: 'foo',
14 | kind: CompletionItemKind.Function,
15 | documentation: new MarkdownString('My foo').appendCodeblock(`foo: () => true`, 'js')
16 | }
17 | ]);
18 | });
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/test/vue3/features/diagnostics/eslint.test.ts:
--------------------------------------------------------------------------------
1 | import { getDocUri } from '../../path';
2 | import { testNoDiagnostics } from '../../../diagnosticHelper';
3 |
4 | describe('Should find diagnostics using eslint-plugin-vue', () => {
5 | const docUri = getDocUri('diagnostics/ESLint.vue');
6 |
7 | it('shows no error for multi-root template, which is valid in v3', async () => {
8 | await testNoDiagnostics(docUri);
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/test/vue3/features/diagnostics/propValidation.test.ts:
--------------------------------------------------------------------------------
1 | import { getDocUri } from '../../path';
2 | import { testDiagnostics, testNoDiagnostics } from '../../../diagnosticHelper';
3 | import { sameLineRange } from '../../../util';
4 | import { DiagnosticSeverity } from 'vscode';
5 |
6 | describe('Should find prop validation errors', () => {
7 | const rightUri = getDocUri('diagnostics/propValidation/ParentRight.vue');
8 |
9 | it('shows no diagnostics error for prop validator in vue3 v-model', async () => {
10 | await testNoDiagnostics(rightUri);
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/test/vue3/features/semanticTokens/basic.test.ts:
--------------------------------------------------------------------------------
1 | import { SemanticTokenModifiers, SemanticTokenTypes } from 'vscode-languageserver-protocol';
2 | import { getTokenRange, testSemanticTokens } from '../../../semanticTokenHelper';
3 | import { getDocUri } from '../../path';
4 |
5 | describe('semantic tokens', () => {
6 | const docPath = 'semanticTokens/Basic.vue';
7 | const docUri = getDocUri(docPath);
8 |
9 | it('provide semantic tokens', async () => {
10 | await testSemanticTokens(docUri, [
11 | {
12 | type: SemanticTokenTypes.method,
13 | range: getTokenRange(7, 2, 'setup'),
14 | modifiers: [SemanticTokenModifiers.declaration]
15 | },
16 | {
17 | type: SemanticTokenTypes.variable,
18 | range: getTokenRange(8, 10, 'a'),
19 | modifiers: [SemanticTokenModifiers.readonly, SemanticTokenModifiers.declaration, 'local']
20 | },
21 | {
22 | type: SemanticTokenTypes.function,
23 | range: getTokenRange(8, 14, 'ref'),
24 | modifiers: []
25 | },
26 | {
27 | type: SemanticTokenTypes.variable,
28 | range: getTokenRange(10, 4, 'a'),
29 | modifiers: [SemanticTokenModifiers.readonly, 'local']
30 | },
31 | {
32 | type: SemanticTokenTypes.property,
33 | range: getTokenRange(10, 6, 'value'),
34 | modifiers: ['refValue']
35 | }
36 | ]);
37 | });
38 | });
39 |
--------------------------------------------------------------------------------
/test/vue3/fixture/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "vetur.experimental.templateInterpolationService": true,
3 | "vetur.validation.templateProps": true
4 | }
--------------------------------------------------------------------------------
/test/vue3/fixture/beforeAll.vue:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/classComponent/Child.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
23 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/classComponent/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/propertyDecorator/Child.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
33 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/propertyDecorator/ChildWithEmitsOption.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
40 |
--------------------------------------------------------------------------------
/test/vue3/fixture/completion/interpolation/propertyDecorator/Parent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
21 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/ESLint.vue:
--------------------------------------------------------------------------------
1 |
2 | {{ 3 < 5 }}
3 |
4 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/emitTypeValidation/JSChild.vue:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/emitTypeValidation/ParentRight.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
40 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/emitTypeValidation/ParentWrong.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
40 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/emitTypeValidation/PropertyChild.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
33 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/emitTypeValidation/TSChild.vue:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/propTypeValidation/JSChild.vue:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/propTypeValidation/ParentRight.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
33 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/propTypeValidation/ParentWrong.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/propTypeValidation/TSChild.vue:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/propValidation/ParentRight.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
30 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/propValidation/TSChild.vue:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/scriptSetup1.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/scriptSetup2.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
18 |
21 |
--------------------------------------------------------------------------------
/test/vue3/fixture/diagnostics/scriptSetupDiag.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
23 |
--------------------------------------------------------------------------------
/test/vue3/fixture/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "vue": "^3.2.47",
4 | "vue-class-component": "^8.0.0-rc.1"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/test/vue3/fixture/semanticTokens/Basic.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
15 |
--------------------------------------------------------------------------------
/test/vue3/fixture/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.vue' {
2 | import { defineComponent } from 'vue';
3 | const component: ReturnType;
4 | export default component;
5 | }
6 |
--------------------------------------------------------------------------------
/test/vue3/fixture/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "strict": true,
4 | "lib": ["dom", "es5"],
5 | "experimentalDecorators": true
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/test/vue3/index.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import Mocha from 'mocha';
3 | import glob from 'glob';
4 |
5 | export function run(): Promise {
6 | const args = {};
7 |
8 | Object.keys(process.env)
9 | .filter(k => k.startsWith('MOCHA_'))
10 | .forEach(k => {
11 | args[k.slice('MOCHA_'.length)] = process.env[k];
12 | });
13 |
14 | const mocha = new Mocha({
15 | ui: 'bdd',
16 | timeout: 100000,
17 | color: true,
18 | ...args
19 | });
20 |
21 | const testsRoot = __dirname;
22 |
23 | return new Promise((c, e) => {
24 | glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
25 | if (err) {
26 | return e(err);
27 | }
28 |
29 | // Add files to the test suite
30 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
31 |
32 | try {
33 | // Run the mocha test
34 | mocha.run(failures => {
35 | if (failures > 0) {
36 | e(new Error(`${failures} tests failed.`));
37 | } else {
38 | c();
39 | }
40 | });
41 | } catch (err) {
42 | e(err);
43 | }
44 | });
45 | });
46 | }
47 |
--------------------------------------------------------------------------------
/test/vue3/path.ts:
--------------------------------------------------------------------------------
1 | import { Uri } from 'vscode';
2 | import { resolve } from 'path';
3 |
4 | export const getDocPath = (p: string) => {
5 | return resolve(__dirname, `../../../test/vue3/fixture`, p);
6 | };
7 | export const getDocUri = (p: string) => {
8 | return Uri.file(getDocPath(p));
9 | };
10 |
--------------------------------------------------------------------------------
/tsconfig.options.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2017",
4 | "module": "commonjs",
5 | "esModuleInterop": true,
6 | "allowSyntheticDefaultImports": true,
7 | "moduleResolution": "node",
8 | "resolveJsonModule": true,
9 | "strict": true,
10 | "sourceMap": true
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "curly": true,
5 | "import-spacing": true,
6 | "indent": [true, "spaces", 2],
7 | "interface-over-type-literal": true,
8 | "label-position": true,
9 | "max-line-length": [true, 120],
10 | "no-arg": true,
11 | "no-duplicate-variable": true,
12 | "no-eval": true,
13 | "no-inferrable-types": true,
14 | "no-unused-expression": true,
15 | "no-var-keyword": true,
16 | "object-literal-key-quotes": [true, "as-needed"],
17 | "object-literal-shorthand": true,
18 | "prefer-const": true,
19 | "prefer-method-signature": true,
20 | "quotemark": [true, "single", "avoid-escape"],
21 | "whitespace": true,
22 | "semicolon": [true, "always"],
23 | "triple-equals": true,
24 | "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"]
25 | },
26 | "linterOptions": {
27 | "exclude": [
28 | "**/node_modules/**",
29 | "**/*.d.ts"
30 | ]
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vti/README.md:
--------------------------------------------------------------------------------
1 | # Vetur Terminal Interface
2 |
3 | 🚧 WIP. This feature is not stable yet. 🚧
4 |
5 | VTI is a CLI that exposes some of Vetur's language features:
6 |
7 | - [x] Diagnostic errors
8 | - [ ] Formatting
9 |
10 | ## Usage
11 |
12 | ```bash
13 | npm i -g vti
14 | # or yarn global add vti
15 | # In your Vue project root
16 | vti diagnostics
17 | ```
18 |
--------------------------------------------------------------------------------
/vti/bin/vti:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | require('../dist/cli.js')
--------------------------------------------------------------------------------
/vti/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vti",
3 | "description": "Vetur Terminal Interface",
4 | "version": "0.1.11",
5 | "main": "./dist/cli.js",
6 | "bin": "./bin/vti",
7 | "author": "Pine Wu ",
8 | "license": "MIT",
9 | "dependencies": {
10 | "commander": "^9.4.1",
11 | "vls": "^0.8.5"
12 | },
13 | "scripts": {
14 | "compile": "rollup -c rollup.config.js",
15 | "watch": "rollup -c rollup.config.js -w"
16 | },
17 | "devDependencies": {
18 | "@babel/code-frame": "^7.18.6",
19 | "@types/babel__code-frame": "^7.0.3",
20 | "@types/glob": "^8.0.1",
21 | "chalk": "^4.1.2",
22 | "glob": "^8.1.0",
23 | "rollup": "^3.17.0",
24 | "typescript": "^4.9.5",
25 | "vscode-languageclient": "^7.0.0",
26 | "vscode-languageserver": "^7.0.0",
27 | "vscode-languageserver-protocol": "^3.16.0",
28 | "vscode-languageserver-types": "^3.17.2",
29 | "vscode-uri": "^3.0.7"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/vti/rollup.config.js:
--------------------------------------------------------------------------------
1 | const { getRootPath, clearDist, external, onwarn, createPlugins } = require('../build/rollup-common-config');
2 | const vtiPkg = require('./package.json');
3 |
4 | const getVTIPath = getRootPath('vti');
5 |
6 | clearDist(getVTIPath('dist'));
7 | module.exports = {
8 | input: getVTIPath('src/cli.ts'),
9 | output: { file: getVTIPath(vtiPkg.main), name: vtiPkg.name, format: 'cjs', sourcemap: true },
10 | external: [...external, 'vls'],
11 | onwarn,
12 | watch: {
13 | include: getVTIPath('**')
14 | },
15 | plugins: createPlugins(getVTIPath('tsconfig.json'))
16 | };
17 |
--------------------------------------------------------------------------------
/vti/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.options.json",
3 | "compilerOptions": {
4 | "composite": true,
5 | "outDir": "./dist",
6 | "rootDir": "src"
7 | },
8 | "include": ["src/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------