-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add APIs for enabling CompileOnSave on tsserver #9837
Changes from 22 commits
305a48f
415662c
b0144b0
d27c4b2
6fae29e
4c962e0
c2b0023
acfa893
9bcb9b7
fb57e08
d1f6a6f
4270ee1
9f4833a
2d66aad
b1a1658
4e05b34
a661bad
3367f79
6f0b332
dc359e7
46e0dee
7d1517b
2f49d16
2a021bd
54f5c72
600b05d
f1880d4
f4a0a34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,10 @@ namespace ts { | |
name: "charset", | ||
type: "string", | ||
}, | ||
{ | ||
name: "compileOnSave", | ||
type: "boolean", | ||
}, | ||
{ | ||
name: "declaration", | ||
shortName: "d", | ||
|
@@ -709,14 +713,16 @@ namespace ts { | |
options.configFilePath = configFileName; | ||
|
||
const { fileNames, wildcardDirectories } = getFileNames(errors); | ||
const compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); | ||
|
||
return { | ||
options, | ||
fileNames, | ||
typingOptions, | ||
raw: json, | ||
errors, | ||
wildcardDirectories | ||
wildcardDirectories, | ||
compileOnSave | ||
}; | ||
|
||
function getFileNames(errors: Diagnostic[]): ExpandResult { | ||
|
@@ -771,6 +777,17 @@ namespace ts { | |
} | ||
} | ||
|
||
export function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean { | ||
if (!hasProperty(jsonOption, "compileOnSave")) { | ||
return false; | ||
} | ||
const result = convertJsonOption({ name: "compileOnSave", type: "boolean" }, jsonOption["compileOnSave"], basePath, errors); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extract |
||
if (typeof result == "boolean") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return result; | ||
} | ||
return false; | ||
} | ||
|
||
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions, errors: Diagnostic[] } { | ||
const errors: Diagnostic[] = []; | ||
const options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasProperty(jsonOption, compileOnSaveCommandLineOption.name)