-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support formating a section of markdown #132
Comments
The remark language server can’t support range formatting, because remark doesn’t support formatting text ranges. Personally I’m not very interested in this feature, but I would be willing to implement this if unified and remark support it. I don’t really understand how this should work or if this is even possible with the current architecture. |
Can’t work? Footnote definitions, regular definitions, could be anywhere else. |
I'm not 100% sure, but If I understand it correctly, the rangeformating request will provide the whole file and a range that should be formated. So the complete document is available for parsing. It should just return text edits, for the selected text. So without looking a the current implementation, if there are several edits on the whole file they could be filtered to just return those in the range. Assuming they do not depend o another. So there should be no problem misinterpreting inline text for blogs or something as frontmatter that isn't. But it still looks like this is the wrong repo for this issue… |
I’m ok with tracking this here. If this feature appears upstream, it eventually needs to end up here. Currently the whole file is parsed and reformatted when formatting. This is one big edit. It’s possible to calculate text diffs and convert those to formatting ranges. This is done for example in |
Initial checklist
Problem
VSCode has a
format section
command this is currently not supported by this extension.If supported this allows
editor.formatOnSaveMode
withmodificationsIfAvailable
to only format modified lienes (if I understood correctly)Solution
It is said in the vscode extensions docs that the extension need to respond to the
textDocument/rangeFormatting
request.Alternatives
For
formatOnSave
the mode can be set tofile
, to allow formatting on save, without the benefit of formating only changed text.The text was updated successfully, but these errors were encountered: