Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #20 from muhajirdev/master
Browse files Browse the repository at this point in the history
fix: @apply issue. Don't do validation on postcss
  • Loading branch information
jamesbirtles authored Oct 7, 2019
2 parents 188a4fe + 435db99 commit bcbed98
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/plugins/CSSPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ export class CSSPlugin
return [];
}

return getLanguageService(extractLanguage(document))
const kind = extractLanguage(document);

if (shouldExcludeValidation(kind)) {
return [];
}

return getLanguageService(kind)
.doValidation(document, stylesheet)
.map(diagnostic => ({ ...diagnostic, source: 'css' }));
.map(diagnostic => ({ ...diagnostic, source: getLanguage(kind) }));
}

doHover(document: Document, position: Position): Hover | null {
Expand Down Expand Up @@ -209,6 +215,16 @@ function getLanguage(kind?: string) {
}
}

function shouldExcludeValidation(kind?: string) {
switch (kind) {
case 'postcss':
case 'text/postcss':
return true;
default:
return false;
}
}

function getLanguageService(kind?: string): LanguageService {
const lang = getLanguage(kind);
return langs[lang];
Expand Down

0 comments on commit bcbed98

Please sign in to comment.