Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Inline editor includes comment after rule #340

Closed
njx opened this issue Feb 29, 2012 · 6 comments
Closed

Inline editor includes comment after rule #340

njx opened this issue Feb 29, 2012 · 6 comments

Comments

@njx
Copy link
Contributor

njx commented Feb 29, 2012

Create the following CSS and HTML files:

.foo {
    width: 200px;
}

/*
 * this is a long
 * comment
 */
<div class="foo"></div>

and hit Cmd-E on the class attribute.

Result: The inline editor shows the entire rule and then part of the comment, up to but not including the last line.

@jasonsanjose
Copy link
Member

This is a limitation of LESS' AST. We don't have an a token (like the closing brace or the comment) to even compute a reasonable lineEnd. The nearest node is the last declaration in the ruleset. For now, I just backtrack from the following rule to find the closest non-whitespace char.

@njx
Copy link
Contributor Author

njx commented Feb 29, 2012

Maybe we could look in the source to backtrack to the immediately previous right brace.

@jasonsanjose
Copy link
Member

In progress

jasonsanjose added a commit that referenced this issue Mar 1, 2012
Changed tree traversing to include all nodes, not just rulesets. Account for non-ruleset nodes and trim off text content so that trailing comments are not included in a RuleSetInfo.

Fix bug in file delta checking where files were always re-parsed.
redmunds added a commit that referenced this issue Mar 2, 2012
@njx
Copy link
Contributor Author

njx commented Mar 2, 2012

I'm still seeing weird behavior here--it's still getting the first line of the comment below the rule. Reassigning back to @jason-sanjose

@jasonsanjose
Copy link
Member

Back to NJ to close with new CSSUtils.

@njx
Copy link
Contributor Author

njx commented Mar 3, 2012

Confirmed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants