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

Executing vscode.executeFormatDocumentProvider with HTML files can return end range exceeding file length #175298

Closed
allisonchou opened this issue Feb 24, 2023 · 5 comments
Assignees
Labels
formatting Source formatter issues under-discussion Issue is under discussion for relevance, priority, approach

Comments

@allisonchou
Copy link
Member

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.76.0-insider
  • OS Version: Windows 11

Using the built-in command vscode.executeFormatDocumentProvider (spec'd here) using an HTML URI can return a range that exceeds the length of the source file.

For example, invoking the above command on a completely empty HTML file will return a range of (startPosition: (0, 0); endPosition: (1, 0)) despite there only being one line in the file. This has caused several bugs to be filed on the Razor team. We've implemented a workaround for now, but we hope to have this issue formally fixed in the near future.

@jrieken jrieken added formatting Source formatter issues under-discussion Issue is under discussion for relevance, priority, approach labels Feb 24, 2023
@jrieken
Copy link
Member

jrieken commented Feb 24, 2023

These commands return the data mostly as provided by extensions - no much cleanup or other tweaks. The editor, before applying, sanitises and minimises edits only later

@allisonchou
Copy link
Member Author

@jrieken From my understanding, the HTML experience in VS Code is built-in and is not provided by a specific extension. Is that assumption incorrect?

@jrieken
Copy link
Member

jrieken commented Feb 27, 2023

Yes and no. HTML is also an extension but it is bundled with the product (that's the only special thing about it)

@allisonchou
Copy link
Member Author

@jrieken Gotcha, thanks for the clarification. I think perhaps this issue should be moved to the microsoft/vscode-html-languageservice repo then? Would you be able to transfer it?

@allisonchou
Copy link
Member Author

I ended up just creating another issue in the microsoft/vscode-html-languageservice repo - microsoft/vscode-html-languageservice#153. I'll close this one out, thanks!

@allisonchou allisonchou closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
formatting Source formatter issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

2 participants