Skip to content

Commit

Permalink
Fix #2131
Browse files Browse the repository at this point in the history
  • Loading branch information
octref committed Aug 26, 2020
1 parent aaff6be commit a6ce17e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### 0.27.0

- Add setting `vetur.validation.interpolation` so interpolation diagnostics and `eslint-plugin-vue` diagnostics can be configed separately. #2131.
- Fix VLS crash for *.vue files in node_modules. #2006.
- Upgrade to TypeScript 4.0.2 and fix symbol outline issue. #1849.
- Improve JSDoc presentation in hover/completion in interpolation mode. #1337.
Expand Down
2 changes: 1 addition & 1 deletion docs/interpolation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Vetur now offers completion, diagnostics, hover, jump to definition, find refere
## Generic Language Features

::: warning
These features are experimental and you need to set `vetur.experimental.templateInterpolationService: true` to enable them. You can also only disable template diagnostics with `vetur.validation.template: false`, although that disables the built-in ESLint checking, too.
These features are experimental and you need to set `vetur.experimental.templateInterpolationService: true` to enable them. You can also only disable template diagnostics with `vetur.validation.interpolation: false`.
:::

Currently diagnostics, hover, jump to definition and find references are implemented in this way:
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@
"default": true,
"description": "Validate vue-html in <template> using eslint-plugin-vue"
},
"vetur.validation.interpolation": {
"type": "boolean",
"default": true,
"description": "Validate interpolations in <template> region using TypeScript language service"
},
"vetur.validation.style": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -510,7 +515,7 @@
"vetur.experimental.templateInterpolationService": {
"type": "boolean",
"default": false,
"description": "Enable template interpolation service that offers diagnostics / hover / definition / references."
"description": "Enable template interpolation service that offers hover / definition / references in Vue interpolations."
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface VLSConfig {
};
validation: {
template: boolean;
interpolation: boolean;
style: boolean;
script: boolean;
};
Expand Down Expand Up @@ -78,6 +79,7 @@ export function getDefaultVLSConfig(): VLSFullConfig {
useWorkspaceDependencies: false,
validation: {
template: true,
interpolation: true,
style: true,
script: true
},
Expand Down
5 changes: 3 additions & 2 deletions server/src/modes/template/interpolationMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import { LanguageModelCache } from '../../embeddedSupport/languageModelCache';
import { HTMLDocument } from './parser/htmlParser';
import { isInsideInterpolation } from './services/isInsideInterpolation';
import * as Previewer from '../script/previewer';
import { VLSFullConfig } from '../../config';

export class VueInterpolationMode implements LanguageMode {
private config: any = {};
private config: VLSFullConfig;

constructor(
private tsModule: T_TypeScript,
Expand All @@ -51,7 +52,7 @@ export class VueInterpolationMode implements LanguageMode {
}

doValidation(document: TextDocument): Diagnostic[] {
if (!_.get(this.config, ['vetur', 'experimental', 'templateInterpolationService'], true)) {
if (!this.config.vetur.validation.interpolation) {
return [];
}

Expand Down

0 comments on commit a6ce17e

Please sign in to comment.