facelessuser / ColorHelper

Sublime plugin that provides helpful color previews and tooltips
https://facelessuser.github.io/ColorHelper/
MIT License
254 stars 30 forks source link

CSS Indentions #239

Closed FileEX closed 1 year ago

FileEX commented 1 year ago

Description

BUG

Hello, I’m having a frustrating problem with CSS indentation.

When I type some class and press “Enter”, there is an indent before the class declaration. This only occurs if in class above is color preview.

image Press enter... image

Without color preview indentations doesn't appear. image

I have no other packages.

Console is clear.

Support Info

Steps to Reproduce Issue

  1. Write some class in CSS with e.g "background-color" property.
  2. Under class with color preview write second another class and press "enter"
facelessuser commented 1 year ago

I am not experiencing this in any way.

I am using the default CSS syntax (I'm not sure if you are or not). I'm using the latest Sublime Text as well:

ch

The truth is, this could be caused by using some other syntax package that has some other snippets, maybe some other plugin, I have no idea, but I cannot seem to reproduce this, and it doesn't make sense that I would be able to. ColorHelper doesn't change the actual syntax of the code, it just injects an inline phantom.

If you have a reproducible example, please paste in plain text so I can copy/paste and test. Please provide any additional information you can think of that would help narrow this down the issue, language syntax package if you aren't using default CSS, if you are using some CSS LSP stuff, or other CSS related plugins, etc.

FileEX commented 1 year ago

I'm using default CSS syntax without any snippets and packagaes. I think that this problem isn't a bug with ColorHelper only because with LSP / LSP-css packages this problem also occurs.

This bug is totally randomly - Sometimes indentions are added and sometimes everything is ok.

I was testing this on a "clear" Sublime Text 4 without any plugins and themes - Only with ColorHelper first and this problem was occurs. The same situation is with LSP package.

Maybe this is some issue with rendering engine and phantoms?

See this discussion: https://forum.sublimetext.com/t/werid-css-indentions/66239/6

facelessuser commented 1 year ago

Then this may be an issue with Sublime. All we are doing is inserting a phantom. This shouldn't change how Sublime processes text. In fact, it should not change how Sublime processes text.

Unfortunately, my hands are probably tied on this as I have no way to fix what Sublime is doing. A possible workaround is to set preview_on_select to true in the settings. This would only render previews on a line when you select the line. This may alleviate the weird indentation issue as phantoms would not be rendered by default except on a line you are selecting. As soon as a line is no longer focused, previews should go away.

Sublime should fix this issue, I don't believe plugins are responsible.

facelessuser commented 1 year ago

As this seems to be an upstream issue, we will close the issue here.