Sublime Forum

LSP Intelephense prevents autocompletion of CSS in PHP files | Help me get it back

#1

By default, Sublime auto-completes project class names / ID’s inside html tags in PHP files.

However when I install LSP + LSP Intelephense, and nothing else the CSS auto-complete inside of HTML tags is lost almost entirely.

Pressing need: How do I regain CSS autocomplete inside the following scopes with LSP-Intelephense enabled?

embedding.php 
text.html.basic 
meta.tag.block.any.html 
meta.attribute-with-value.class.html 
meta.string.html string.quoted.double.html 
punctuation.definition.string.end.html

Pie in the sky: I’d love to somehow configure CSS auto-completion inside the following scope:

meta.string.php 
string.quoted.double.php 
punctuation.definition.string.end.php

I’m using completely default Intelephense settings (minus premium license key). No other plugins, theme files or anything

0 Likes

#2

It looks like there is default_completions_selector in CSS.sublime-settings (syntax-specific settings).


Yet, I am not sure who provides “By default, Sublime auto-completes project class names / ID’s inside html tags in PHP files.” But it sound like ST’s builtin AC (no python magic) to me. This may be related to LSP’s settings.

  // Disable Sublime Text's word completions. When set to `true`, this also disables Sublime Text's internal completion
  // sorting algorithm and instead uses the sorting defined by the relevant language server.
  "inhibit_word_completions": true,
1 Like

#3

@jfcherng is completely correct. ID and class names defined in CSS files are indexed. ST therefore includes those in builtin auto completions by default (see "auto_complete_use_index": true, setting).

Those are disabled by LSP via inhibit_word_completions by default. Setting it false brings class/id completions back.

Note: As per design only those indexed class names or id’s are suggested via auto-completions, which appear at least once in content of active view.


Intelliphense provides CSS completions. I see both, LSP’s and default completions within style attributes as expected. (ST 4126, Win11, LSP 1.16.2, LSP-intelliphense 1.0.25)

grafik

Language servers and ST’s builtin css_completions plugin both rely on source.css scope to know when to provide completions. Thus it is not possible to provide completions in plain strings.


Pie in the sky : I’d love to somehow configure CSS auto-completion inside the following scope:

If that statement however also just targets CSS classes and IDs, those are provided everywhere ST thinks those are appropriate. Don’t have any insight or idea about related heuritstics however, nor am I aware of any setting to tweak that behavior.

1 Like

#4

Thank you @jfcherng and @deathaxe, setting "inhibit_word_completions": true did in fact fix the issue in the question.

That change isn’t going to prevent relevant language server from also providing context-specific completions, will it?

0 Likes

#5

No it won’t prevent language server’s from providing completions. May just have some impact on completions sorting.

0 Likes