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

Formatting for sass #1433

Closed
TheRealSyler opened this issue Sep 16, 2019 · 3 comments
Closed

Formatting for sass #1433

TheRealSyler opened this issue Sep 16, 2019 · 3 comments

Comments

@TheRealSyler
Copy link
Contributor

Im currently working on making my sass formatter work with this extension, is there a way to get the TextDocument Object from vscode ?
since i made my formatter in a vscode extension i worked with the TextDocument from vscode, right now im looping trough the text two times one time to create an object that is similar to the TextDocument object and one time to format the code, i could probably rewrite the formatter but i don't want to spend my time doing that since it already works.

i could just add formatting for vue files in my extension, but i think it would be nice to have it in this extension, so that the vetur supports everthing to do with vue and the sass extension just supports sass files, i also added hover info for some properties, and im working on a linter all stuff that can also be added to this extension.

@octref
Copy link
Member

octref commented Sep 17, 2019

TextDocument in VS Code is different from TextDocument in LSP. What are you missing from the LSP TextDocument?

Vue Language Server works with multiple modes. See https://github.com/vuejs/vetur/tree/master/server/src/modes
The way this should be added is sass added as one more mode along style (which is really a misnomer, it should be css-less-scss).

If you install the dependencies in server, this signature would give you all info needed for implementing formatting: https://github.com/vuejs/vetur/blob/master/server/src/embeddedSupport/languageModes.ts#L64

Thanks for your work on SASS! It has been a requested many times for Vetur to add better sass support.

@TheRealSyler
Copy link
Contributor Author

TheRealSyler commented Sep 18, 2019

@octref my fork i already have added a new mode.

the only problem is that i need a document object that has lineAt which needs to return a line object that has a text and lineNumber property, since the lSP TextDocument doesn't have the properties that i need i was wondering if its possible to get the vscode version of the TextDocument.

this is the class that i currently use to convert text to an object similar to vscodes TextDocument, creating this class can be skipped, as you can see here i just pass the vscode TextDocument, in the vetur implementation i need to create the SassTextDocument class to make it work.

@octref
Copy link
Member

octref commented Feb 11, 2020

Fixed by #1658.

@octref octref closed this as completed Feb 11, 2020
octref added a commit that referenced this issue Feb 11, 2020
@octref octref added this to the February 2020 milestone Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants