LESS-sublime icon indicating copy to clipboard operation
LESS-sublime copied to clipboard

Autocomplete variables AFTER a property does not seem to work?

Open hawkerboy7 opened this issue 3 years ago • 11 comments

Hi,

First thank you for the project! =)

I have this issue below. 1 2

I would expect the variables to auto-complete after a property as well, but it doesn't. Do I need to configure something differently, is my expectation incorrect or is this not (yet) possible?

background-color--1 and others come from a different .less file in the same project folder, so it can find them but just not after a property (where I need them the most:) )

I am on v2.7.4

hawkerboy7 avatar Dec 11 '21 11:12 hawkerboy7

That first statement looks like it's invalid. It's not a variable assignment, and thus will not show up in completions.

braver avatar Dec 12 '21 19:12 braver

I am not sure what you mean by that, could you clarify?

When I start typing in a .less file starting with the @ sign as shown in the first image, I do get the auto-complete I would expect to get, so showing the auto-complete pop-up window with variables I've defined in other files of the same project.

If you mean the resulting statement

.test {
    @background-color--1;
}

won't change the appearance of the class .test then yes that is correct, but that is not the issue.

On the second image you see the auto-complete pop-up window but it does not show the variables you do see in the first image.
If you mean the .less syntax might now be broken due to the first statement being invalid; this issue still remains also if you change the statements around.

1 2

EDIT:

Also defining the variable in the same file has the same issue, if that is what you ment.

1

hawkerboy7 avatar Dec 12 '21 22:12 hawkerboy7

Is there anyone with some input on what could be wrong? Would be very much appreciated :)

hawkerboy7 avatar Feb 04 '22 23:02 hawkerboy7

Hi @braver, would you be able to shed some light on this? Thank you!

hawkerboy7 avatar May 11 '22 19:05 hawkerboy7

The first screenshot seems to show ST's word completions. The second screenshot displays plugin-based auto-completions from less_completions.py. The plugin disables word completions and doesn't support @vars on the other hand. Thus no variables are displayed.

deathaxe avatar Apr 29 '23 08:04 deathaxe

Honestly I haven't looked at this syntax for a while now. I have been focussing on SCSS, trying to improve that structurally and in a way that aligns it with the default CSS syntax and keeps it maintainable. I'm not happy with how that is going, but that's the plan: after the 3.0 rewrite improve SCSS further, and then cycle back and rewrite LESS in a similar way. In both syntaxes currently CSS properties are prioritised in completions, and variables, mixins, functions etc. are either not suggested at all or in a very limited way.

Of course, as always, I would definitely welcome contributions and pull requests.

braver avatar Apr 29 '23 12:04 braver

@deathaxe Thank you for your anwser! There probably is not an easy way for the less_completion.py plugin not to diable the word completions?

hawkerboy7 avatar Apr 29 '23 12:04 hawkerboy7

@braver Clear, thank you! I am not familiar with this project. Could you point me in the right direction to be able to make a pull request. By that I mean maybe some files and general solution method approach?

hawkerboy7 avatar Apr 29 '23 12:04 hawkerboy7

Word completions can turned on by removing sublime.INHIBIT_WORD_COMPLETIONS from https://github.com/danro/LESS-sublime/blob/836b47ec61a9c6a6445b4007e8353337fe63e2c9/less_completions.py#LL649C48-L649C48

deathaxe avatar Apr 29 '23 13:04 deathaxe

@deathaxe This worked! The suggestions are without the "@" sign of the variable but that is not a problem and loads better than no suggestion at all :) Thank you!

@braver Though this is a work-around, for me the issue can be closed if you prefer.

hawkerboy7 avatar Apr 29 '23 14:04 hawkerboy7

Good. Let's keep it open though, as a reminder that completions need work.

braver avatar Apr 29 '23 16:04 braver

FWIW, word completions are no longer inhibited. This issue can be closed.

deathaxe avatar Feb 25 '24 17:02 deathaxe

Confirmed

braver avatar Feb 26 '24 18:02 braver

Just tested it and it works indeed, thank you! :+1:

hawkerboy7 avatar Feb 29 '24 15:02 hawkerboy7