-
Notifications
You must be signed in to change notification settings - Fork 177
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
feat: support hover tooltip for scss #367
Merged
aeschli
merged 5 commits into
microsoft:main
from
balaji-sivasakthi:balaji-sivasakthi/peaceful-guanaco
Feb 28, 2024
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
00621af
feat: support media in scss tooltip
balaji-sivasakthi aaf455c
test: hover media query in scss
balaji-sivasakthi cbc6149
fix: type issue
balaji-sivasakthi 1adce32
Merge branch 'main' into balaji-sivasakthi/peaceful-guanaco
aeschli a6f7ec9
fix: `toString()` and code style
balaji-sivasakthi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,13 +38,23 @@ export class CSSHover { | |
* Build up the hover by appending inner node's information | ||
*/ | ||
let hover: Hover | null = null; | ||
let flagOpts:{text:string;isMedia:boolean}; | ||
|
||
for (let i = 0; i < nodepath.length; i++) { | ||
const node = nodepath[i]; | ||
|
||
if (node instanceof nodes.Media){ | ||
const regex = /@media[^\{]+/g; | ||
const matches = node.getText().match(regex); | ||
flagOpts = { | ||
isMedia:true, | ||
text:matches?.[0].toString()! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, I removed it. |
||
}; | ||
} | ||
|
||
if (node instanceof nodes.Selector) { | ||
hover = { | ||
contents: this.selectorPrinting.selectorToMarkedString(<nodes.Selector>node), | ||
contents: this.selectorPrinting.selectorToMarkedString(<nodes.Selector>node, flagOpts!), | ||
range: getRange(node) | ||
}; | ||
break; | ||
|
@@ -149,7 +159,7 @@ export class CSSHover { | |
return contents.value; | ||
} | ||
} | ||
|
||
return contents; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the formatter (default Typescript formatter)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ok now, I runned default prettier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I rise an issue for format script. It might helps other engineers to follow common format configuration.