Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial implementation #1

Merged
merged 3 commits into from
Nov 14, 2024
Merged

Add initial implementation #1

merged 3 commits into from
Nov 14, 2024

Conversation

niksy
Copy link
Collaborator

@niksy niksy commented Nov 12, 2024

As per sublimelsp/repository#124, this PR adds initial implementation for language server.

README.md Outdated

### Installation

* Install [LSP](https://packagecontrol.io/packages/LSP) and `LSP-twiggy` via Package Control.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a step to install the Twig Syntax here -> https://packagecontrol.io/packages/Twig.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@rchl
Copy link
Member

rchl commented Nov 12, 2024

I don't know how important that functionality is but I see that the VSCode extension has client-side logic to request (additional?) completions from the server for the virtual embedded-content schema: https://github.com/moetelo/twiggy/blob/1e9acaeb47e8887a69181ebe5cc418392afba3be/packages/vscode/src/extension.ts#L136-L143
Looks like completions for the HTML parts of the template or something.

README.md Outdated Show resolved Hide resolved
Co-authored-by: Предраг Николић <[email protected]>
@niksy
Copy link
Collaborator Author

niksy commented Nov 12, 2024

I don't know how important that functionality is but I see that the VSCode extension has client-side logic to request (additional?) completions from the server for the virtual embedded-content schema: moetelo/twiggy@1e9acae/packages/vscode/src/extension.ts#L136-L143 Looks like completions for the HTML parts of the template or something.

Haven’t seen any issues with this, all other buggy stuff has already been submitted as issue by me or someone else, so maybe this will also be addressed as part of making language server more non-VS Code friendly.

@rchl
Copy link
Member

rchl commented Nov 12, 2024

I've submitted moetelo/twiggy#54 btw (unrelated to my previous comment).

To make file watching work for now, you can manually register it - see https://github.com/sublimelsp/LSP-eslint/blob/356d5b3d0ff86647481f9bebf37185804e5ca1d4/LSP-eslint.sublime-settings#L128-L134

@rchl
Copy link
Member

rchl commented Nov 12, 2024

I don't know how important that functionality is but I see that the VSCode extension has client-side logic to request (additional?) completions from the server for the virtual embedded-content schema: moetelo/twiggy@1e9acae/packages/vscode/src/extension.ts#L136-L143 Looks like completions for the HTML parts of the template or something.

Haven’t seen any issues with this, all other buggy stuff has already been submitted as issue by me or someone else, so maybe this will also be addressed as part of making language server more non-VS Code friendly.

I believe this functionality just makes sure that HTML-specific completions are provided when outside of twig templates.

@moetelo
Copy link

moetelo commented Nov 12, 2024

this functionality just makes sure that HTML-specific completions are provided when outside of twig templates.

That's correct. The purpose of the entire provideCompletionItem middleware is to query the Twiggy LSP to check whether we're in Twig context. If we're not in Twig, it then assumes we're in HTML and requests additional HTML completions from VS Code's HTML LSP.


By "HTML context," I mean:

some-file.twig

<div> | </div>

By "Twig context," I mean:

some-file.twig

<div>{{ | }}</div>

@rchl
Copy link
Member

rchl commented Nov 12, 2024

I see. That's very VSCode-specific approach. Ideally the server would bundle the html service and utilize that directly. But oh well, it doesn't seem essential.

(In theory one can run both LSP-html and LSP-twiggy at the same time but I suppose that might create unnecessary completions within context of interpolations)

@rchl
Copy link
Member

rchl commented Nov 14, 2024

I've submitted moetelo/twiggy#54 btw (unrelated to my previous comment).

To make file watching work for now, you can manually register it - see sublimelsp/LSP-eslint@356d5b3/LSP-eslint.sublime-settings#L128-L134

@niksy can you make that change in the mean time?

@niksy
Copy link
Collaborator Author

niksy commented Nov 14, 2024

@rchl done!

@rchl rchl merged commit 7460b5c into sublimelsp:main Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants