-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Invalid emmet abbr returns weird expanded value in css files #27628
Comments
haha |
@sergeche Would you expect the plugin to parse the css file and call |
Sorry to interrupt but this is valid? (such as |
@jens1o It is valid html, so yes it is valid |
Then I'm sorry, but I do not understand what you're trying to say.
|
Oh I mean when taken in the context of css In this issue we are talking about css abbreviation |
Ah, sorry, then I didn't get the subject. |
Since auto-complete will get triggered for every new letter typed, either the emmet plugin should be smart enough not to try to expand |
But is it the css parser who should say this is a valid expression or an invalid? (like I think that would overwhelm the css parser, and block other extensions. I think it should be handled by the emmet extension. |
There's work to be done on both sides. div for eg expands to display:inline-block by the css-abbreviation module because that's the nearest match it can find But .foo clearly is an invalid CSS abbreviation and can be easily be invalidated by the css-abbreviation module. Additionally, the extension shouldn't ask for expansion if it can beforehand figure out that the cursor is not in a "property" line |
nice idea. I think I still tune to the Insiders to give you feedback. |
The plugin itself should implement logic whether a string can be expanded as abbreviation or not. It’s one of the reasons I’ve moved from monolithic codebase to a small, re-usable modules: to allow authors to use editor API for a better Emmet integration with editor features. You use Atom plugin as a reference, here’s an example where I decide where abbreviation can be expanded: https://github.com/emmetio/atom-plugin/blob/master/lib/detect-syntax.js#L17-L20 |
@ramya-rao-a you can re-use |
In the new emmet, would this issue solve the current one when something like |
Can be solved by providing more value samples for |
@sergeche I implemented a stream reader for VS Code's TextDocument, and am currently parsing the document to avoid suggesting emmet expansions in invalid locations like inside the open tag in html or a selector in css. But take the case of scss where you can have nested selectors. In this case, when we start typing a nested selector, the parser is not aware of whether the user is typing another property or a new selector. In this case, we end up with the below both in Atom and VS Code So even though editors try and figure out the right scope for emmet abbreviations, I believe the |
Yes, stubled with this issue too, will fix CSS abbreviation parser |
Yes. Please create a separate issue at https://github.com/emmetio/atom-plugin/issues so I can better track bugs |
Thanks @sergeche ! Logged emmetio/atom-plugin#22 |
Closing this in favor of #27975 |
#27316
The text was updated successfully, but these errors were encountered: