forked from prettier/prettier-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand usage of local prettier instance
Update the status bar and edit provider logic to use the local Prettier instance when possible.
- Loading branch information
1 parent
fe9cf2d
commit 5927e46
Showing
3 changed files
with
23 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,8 @@ export function getParsersFromLanguageId( | |
return language.parsers; | ||
} | ||
|
||
export function allEnabledLanguages(): string[] { | ||
return getSupportLanguages().reduce( | ||
export function allEnabledLanguages(prettierInstance: Prettier): string[] { | ||
return getSupportLanguages(prettierInstance).reduce( | ||
(ids, language) => [...ids, ...(language.vscodeLanguageIds || [])], | ||
[] as string[] | ||
); | ||
|
@@ -52,11 +52,11 @@ export function rangeSupportedLanguages(): string[] { | |
]; | ||
} | ||
|
||
export function getGroup(group: string): PrettierSupportInfo['languages'] { | ||
return getSupportLanguages().filter(language => language.group === group); | ||
export function getGroup(group: string, prettierInstance: Prettier): PrettierSupportInfo['languages'] { | ||
return getSupportLanguages(prettierInstance).filter(language => language.group === group); | ||
} | ||
|
||
function getSupportLanguages(prettierInstance: Prettier = bundledPrettier) { | ||
function getSupportLanguages(prettierInstance: Prettier) { | ||
// prettier.getSupportInfo was added in [email protected] | ||
if (prettierInstance.getSupportInfo) { | ||
return prettierInstance.getSupportInfo(prettierInstance.version).languages; | ||
|