-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
__Issue:__ When formatting a JavaScript file, or other file without a formatter installed by default, and formatting (either via the 'Format Document' command, or key sequences like `gg=G`) - there'd be a confusing 'Invalid range specified' error. __Defect:__ There were actually several issues: 1) When falling back to the default format provider, there was an off-by-one bug that caused that error to be displayed when the whole document was requested to be formatted. 2) In the case of #3014 , there actually is a default format provider - the type script language feature provides a formatter, but it is a range formatter (not a document formatter). However, in the case where there is a range formatter but no document formatter, we can fall back to using the range formatter. 3) The case of multiple format providers wasn't handled in a robust way __Fix:__ 1) Fix the issues with the ranges in the default and language server range formatters 2) Implement logic to fall back to the range formatter in the case where there is no document formatter available 3) Implement proper resolution of format providers. When there are multiple, prompt the user to pick a default formatter. Use the `"editor.defaultFormatter": "publisher.extension-id"` configuration setting to disambiguate, for example: ``` "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" } ``` When the user selects a default, automatically update the configuration.
- Loading branch information
Showing
11 changed files
with
286 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.