Add locale options to tsserver#12369
Merged
zhengbli merged 3 commits intomicrosoft:masterfrom Nov 21, 2016
Merged
Conversation
mhegazy
approved these changes
Nov 18, 2016
Contributor
mhegazy
left a comment
There was a problem hiding this comment.
You need to make sys an argument passed in to the helpers. this way you avoid unexpected side-effects if some one uses it outside the server or tsc.
src/compiler/utilities.ts
Outdated
| } | ||
|
|
||
| export function trySetLanguageAndTerritory(language: string, territory: string, errors?: Diagnostic[]): boolean { | ||
| const compilerFilePath = normalizePath(sys.getExecutingFilePath()); |
Contributor
There was a problem hiding this comment.
make sys and argument here.
Contributor
|
also this will need to be ported to release-2.1 |
mhegazy
reviewed
Nov 19, 2016
src/compiler/utilities.ts
Outdated
| } | ||
|
|
||
| export function trySetLanguageAndTerritory(language: string, territory: string, errors?: Diagnostic[]): boolean { | ||
| export function trySetLanguageAndTerritory(language: string, territory: string, sys: System, errors?: Diagnostic[]): boolean { |
Contributor
There was a problem hiding this comment.
Do not think you need the whole thing..
consider : host: {getExecutingFilePath():string, readFile(name:string):string; }
vladima
suggested changes
Nov 19, 2016
|
|
||
| const localeStr = findArgument("--locale"); | ||
| if (localeStr && validateLocaleAndSetLanguage(localeStr, sys)) { | ||
| validateLocaleAndSetLanguage(localeStr, sys); |
Contributor
There was a problem hiding this comment.
not sure that I get why do we need to call validateLocaleAndSetLanguage twice
Contributor
Author
|
@vladima Sorry that was a mistake, updated. |
vladima
approved these changes
Nov 19, 2016
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the server is always using English diagnostics messages. This PR adds the support to use messages in other locales.