Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vscode): show suggestions in postcss files #2240

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/shared-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function getMatchedPositions(code: string, matched: string[], hasVariantG

// highlight for plain classes
let start = 0
code.split(/([\s"'`;<>]|:\(|\)"|\)\s)/g).forEach((i) => {
code.split(/([\s"'`;<>*]|:\(|\)"|\)\s)/g).forEach((i) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixing the highlighting of classes if @unocss-include is provided in multiline comment syntax:

/* @unocss-include */
@screen at-xs { 
  .class {
    display: flex;
    overflow: hidden;
    @apply flex-col-reverse;
  }
}

const end = start + i.length
if (isPug) {
result.push(...getPlainClassMatchedPositionsForPug(i, plain, start))
Expand Down Expand Up @@ -133,7 +133,7 @@ export function getMatchedPositions(code: string, matched: string[], hasVariantG
const [, pre, sep, body] = match
const index = match.index!
let start = index + pre.length + sep.length + 1
body.split(/([\s"'`;<>]|:\(|\)"|\)\s)/g).forEach((i) => {
body.split(/([\s"'`;<>*]|:\(|\)"|\)\s)/g).forEach((i) => {
const end = start + i.length
const full = pre + sep + i
if (plain.has(full)) {
Expand Down
1 change: 1 addition & 0 deletions packages/vscode/src/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const languageIds = [
'hbs',
'html',
'css',
'postcss',
'javascript',
'javascriptreact',
'markdown',
Expand Down