Skip to content

Commit

Permalink
feat: ignore native CSS service not supporting yet
Browse files Browse the repository at this point in the history
  • Loading branch information
idoros committed Oct 24, 2022
1 parent b042c5a commit 71bf024
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/language-service/src/lib/css-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class CssService {
atRuleName === '@st-scope' ||
atRuleName === '@st-namespace' ||
atRuleName === '@st-import' ||
atRuleName === '@container' ||
atRuleName === '@st-global-custom-property')
) {
return false;
Expand All @@ -163,7 +164,7 @@ export class CssService {
} else if (diag.code === 'unknownProperties') {
const prop = diag.message.match(/'(.*)'/)![1];

if (meta.getStVar(prop)) {
if (meta.getStVar(prop) || prop === 'container' || prop === 'container-name') {
return false;
}
}
Expand Down
25 changes: 25 additions & 0 deletions packages/language-service/test/lib/completions/contains.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { expect } from 'chai';
import { createDiagnostics } from '../../test-kit/diagnostics-setup';
import deindent from 'deindent';

describe('CSS contains', () => {
it('should ignore native css lsp diagnostics unknown container at-rule and declarations', () => {
// remove once css lsp supports is added or we implement the complete lsp ourselves
const filePath = '/style.st.css';

const diagnostics = createDiagnostics(
{
[filePath]: deindent`
@container a (inline-size > 100px) {}
.root {
container-name: a;
container: a / normal;
}
`,
},
filePath
);

expect(diagnostics).to.eql([]);
});
});

0 comments on commit 71bf024

Please sign in to comment.