-
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
Merged
Merged
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
305a48f
Add API to get only the emited declarations output
415662c
Add nonModuleBuilder
b0144b0
WIP
d27c4b2
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
6fae29e
WIP
4c962e0
WIP
c2b0023
Merge branch 'compileOnSave0' of https://github.com/zhengbli/TypeScri…
acfa893
Add basic tests for CompileOnSaveAffectedFileList API
9bcb9b7
Add API for compile single file
fb57e08
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
d1f6a6f
refactor
4270ee1
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
9f4833a
Avoid invoking project.languageService directly
2d66aad
Add API to query if compileOnSave is enabled for a project
zhengbli b1a1658
Seperate check and emit signatures
4e05b34
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
a661bad
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
zhengbli 3367f79
Refactor and address cr
6f0b332
Add more tests
dc359e7
Refactor
zhengbli 46e0dee
Always return cascaded affected list
zhengbli 7d1517b
Correct the tsconfig file in compileOnSave tests
zhengbli 2f49d16
reduce string to path conversion
2a021bd
refactor
zhengbli 54f5c72
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
zhengbli 600b05d
refactor again
zhengbli f1880d4
Merge Microsoft/tsserverVS-WIP
zhengbli f4a0a34
Merge branch 'tsserverVS-WIP' of https://github.com/Microsoft/TypeScr…
zhengbli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,15 @@ | |
/// <reference path="scanner.ts"/> | ||
|
||
namespace ts { | ||
/* @internal */ | ||
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" }; | ||
/* @internal */ | ||
export const optionDeclarations: CommandLineOption[] = [ | ||
{ | ||
name: "charset", | ||
type: "string", | ||
}, | ||
compileOnSaveCommandLineOption, | ||
{ | ||
name: "declaration", | ||
shortName: "d", | ||
|
@@ -709,14 +712,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 +776,17 @@ namespace ts { | |
} | ||
} | ||
|
||
export function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean { | ||
if (!hasProperty(jsonOption, "compileOnSave")) { | ||
return false; | ||
} | ||
const result = convertJsonOption(compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors); | ||
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); | ||
|
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
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.
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.
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)