The color of a property name may change in a LESS file when typing a space before the closing paren. #1289

Closed
opened 2013-02-26 22:45:36 +01:00 by marijnh · 12 comments
marijnh commented 2013-02-26 22:45:36 +01:00 (Migrated from gitlab.com)
  1. Open http://codemirror.net/mode/less/ in a browser.
  2. Set cursor before one of the closing paren on line 111 that has this CSS code border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
  3. Watch the color of the property name border-color and hit a space.

Result: border-color now has a different color.
Expected: should not change the color of the property name.

1. Open http://codemirror.net/mode/less/ in a browser. 2. Set cursor before one of the closing paren on line 111 that has this CSS code `border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);` 3. Watch the color of the property name `border-color` and hit a space. Result: `border-color` now has a different color. Expected: should not change the color of the property name.
marijnh commented 2013-02-26 22:49:16 +01:00 (Migrated from gitlab.com)

You can also see incorrect color if you paste the following CSS into the page.

    .box-warning-rouge{
      border: 1px solid rgba(215, 44, 44, 0.7);
      background: rgba(215, 44, 44, 0.4); 
        &:hover{
           background: rgba(215, 44, 44, 0.2);
        }
    }

.box-warning-rouge{ and border are rendered in the wrong color.

You can also see incorrect color if you paste the following CSS into the page. ``` .box-warning-rouge{ border: 1px solid rgba(215, 44, 44, 0.7); background: rgba(215, 44, 44, 0.4); &:hover{ background: rgba(215, 44, 44, 0.2); } } ``` `.box-warning-rouge{` and `border` are rendered in the wrong color.
marijnh commented 2013-02-26 22:55:01 +01:00 (Migrated from gitlab.com)

mentioned in issue #2847

mentioned in issue #2847
marijnh commented 2013-02-26 23:03:32 +01:00 (Migrated from gitlab.com)

I've been meaning to rewrite Less mode to extend the CSS mode, but I haven't gotten around to it yet. (I think I have it partially done on my box at home.) I'll push this ahead of some other projects I'm working on though, but it still might be a while (I love to procrastinate).

So, if this isn't an easy fix, let me know, and I'll make it my top priority (but still working on at home, so it won't be immediate).

I've been meaning to rewrite Less mode to extend the CSS mode, but I haven't gotten around to it yet. (I think I have it partially done on my box at home.) I'll push this ahead of some other projects I'm working on though, but it still might be a while (I love to procrastinate). So, if this isn't an easy fix, let me know, and I'll make it my top priority (but still working on at home, so it won't be immediate).
marijnh commented 2013-02-27 09:50:40 +01:00 (Migrated from gitlab.com)

@peterkroon Want to take a look?

If the Less mode can be folded into the CSS mode in a clean way, I'd be okay with that -- less code means less room for bugs.

`@peterkroon` Want to take a look? If the Less mode can be folded into the CSS mode in a clean way, I'd be okay with that -- less code means less room for bugs.
marijnh commented 2013-02-27 10:31:00 +01:00 (Migrated from gitlab.com)

I also noticed that when I paste the example code, bracket matching is initially broken when I put my cursor after the last bracket (apparently the opening bracket is somehow styled as "string" when the bracket matcher asks for it), but then when I edit the first line in any way, the problem goes away. Again, this suggests bad handling of state.

I also noticed that when I paste the example code, bracket matching is initially broken when I put my cursor after the last bracket (apparently the opening bracket is somehow styled as `"string"` when the bracket matcher asks for it), but then when I edit the first line in any way, the problem goes away. Again, this suggests bad handling of state.
marijnh commented 2013-02-27 10:31:32 +01:00 (Migrated from gitlab.com)

@RaymondLim
A few months ago I was working on a upgrade of the LESS mode(not finished).
Look here: http://5060.nl/codemirror/CodeMirror-3/mode/less/index.html
I've fixed the bug you mention in your first post in the upgrade.
The second one is new and needs to be fixed.
Another bug in the upgrade version is when you place cursor on line 159 between E``[and add a space and a character the color changes of E. This is incorrect behaviour.

With this upgrade version there is more dynamic highlighting of the code. The goal was/is to make a more professional theme and integrate SCSS which doesn't exists in the repository yet.

I'm able to look at fixing the mentioned bugs upcoming week or the week after that.

`@RaymondLim` A few months ago I was working on a upgrade of the LESS mode(not finished). Look here: http://5060.nl/codemirror/CodeMirror-3/mode/less/index.html I've fixed the bug you mention in your first post in the upgrade. The second one is new and needs to be fixed. Another bug in the upgrade version is when you place cursor on line 159 between `E``[`and add a space and a character the color changes of `E`. This is incorrect behaviour. With this upgrade version there is more dynamic highlighting of the code. The goal was/is to make a more professional theme and integrate SCSS which doesn't exists in the repository yet. I'm able to look at fixing the mentioned bugs upcoming week or the week after that.
marijnh commented 2013-03-03 06:46:40 +01:00 (Migrated from gitlab.com)

Fwiw I did some bisecting, and:

  • The first issue (color changes after adding a space before opening paren) first appeared in 436fa0532. (Although I assume @peterkroon already has a handle on this if it's fixed in his latest code).
  • The second issue (bracket matching) first appeared in 3721870ef -- which interestingly, changes the bracket-matching code but has no changes to less.js itself.
Fwiw I did some bisecting, and: - The first issue (color changes after adding a space before opening paren) first appeared in 436fa0532. (Although I assume `@peterkroon` already has a handle on this if it's fixed in his latest code). - The second issue (bracket matching) first appeared in 3721870ef -- which interestingly, changes the bracket-matching code but has no changes to less.js itself.
marijnh commented 2013-03-14 09:37:27 +01:00 (Migrated from gitlab.com)

I thought I would have some time to fix it this week. But no.
Maybe next week.

I thought I would have some time to fix it this week. But no. Maybe next week.
marijnh commented 2013-09-05 14:26:24 +02:00 (Migrated from gitlab.com)

mentioned in merge request !8963

mentioned in merge request !8963
marijnh commented 2013-09-06 09:56:34 +02:00 (Migrated from gitlab.com)

Fixed with: #1805

Fixed with: #1805
marijnh commented 2013-09-06 10:00:50 +02:00 (Migrated from gitlab.com)

Indeed, looks fixed.

Indeed, looks fixed.
marijnh (Migrated from gitlab.com) closed this issue 2013-09-06 10:00:50 +02:00
marijnh commented 2021-08-29 21:13:53 +02:00 (Migrated from gitlab.com)

mentioned in issue #2695

mentioned in issue #2695
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5#1289
No description provided.