-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Adding tsconfig.json mixed content (script block) support #12153
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da7f824
tsconfig.json mixed content support
jramsay 7dd30db
tsconfig.json mixed content support
jramsay 891173c
Merge branch 'master' into tsconfigMixedContentSupport
jramsay 464bc0e
Merge branch 'master' into tsconfigMixedContentSupportRedux
jramsay 12971d2
Merge branch 'tsconfigMixedContentSupportRedux' into tsconfigMixedCon…
jramsay 64dad30
Reduced version from CR comments
jramsay 1c3689e
Merge branch 'master' into tsconfigMixedContentSupportRedux
jramsay 7a11453
Fix merge issues
jramsay d528943
Changes due to CR comments
jramsay 4cb5a36
Merge branch 'master' into tsconfigMixedContentSupport
jramsay 5f46e48
Mark containing project as dirty when file is closed
jramsay 05160ca
Rename fileExtensionMap: fileExtensionMapItem[] to extraFileExtension…
jramsay 30bd841
Merge branch 'master' into tsconfigMixedContentSupport
jramsay 5829ca8
use localUse local updatedFileNames - this way we'll know that set of…
jramsay c40508c
getSupportedExtensions optimization to reduce allocations
jramsay 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/// <reference path="..\services\services.ts" /> | ||
/// <reference path="..\services\services.ts" /> | ||
/// <reference path="utilities.ts"/> | ||
/// <reference path="scriptInfo.ts"/> | ||
/// <reference path="lsHost.ts"/> | ||
|
@@ -187,6 +187,10 @@ namespace ts.server { | |
public languageServiceEnabled = true; | ||
|
||
builder: Builder; | ||
/** | ||
* Set of files names that were updated since the last call to getChangesSinceVersion. | ||
*/ | ||
private updatedFileNames: Map<string>; | ||
/** | ||
* Set of files that was returned from the last call to getChangesSinceVersion. | ||
*/ | ||
|
@@ -480,6 +484,10 @@ namespace ts.server { | |
this.markAsDirty(); | ||
} | ||
|
||
registerFileUpdate(fileName: string) { | ||
(this.updatedFileNames || (this.updatedFileNames = createMap<string>()))[fileName] = fileName; | ||
} | ||
|
||
markAsDirty() { | ||
this.projectStateVersion++; | ||
} | ||
|
@@ -667,10 +675,12 @@ namespace ts.server { | |
isInferred: this.projectKind === ProjectKind.Inferred, | ||
options: this.getCompilerOptions() | ||
}; | ||
const updatedFileNames = this.updatedFileNames; | ||
this.updatedFileNames = undefined; | ||
// check if requested version is the same that we have reported last time | ||
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. I would make it more like let updatedFileNames = this.updatedFileNames;
this.updatedFileNames = undefined;
/// use local updatedFileNames - this way we'll know that set of names is definitely cleared 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. Yes - good idea |
||
if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { | ||
// if current structure version is the same - return info witout any changes | ||
if (this.projectStructureVersion == this.lastReportedVersion) { | ||
// if current structure version is the same - return info without any changes | ||
if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { | ||
return { info, projectErrors: this.projectErrors }; | ||
} | ||
// compute and return the difference | ||
|
@@ -679,6 +689,7 @@ namespace ts.server { | |
|
||
const added: string[] = []; | ||
const removed: string[] = []; | ||
const updated: string[] = getOwnKeys(updatedFileNames); | ||
for (const id in currentFiles) { | ||
if (!hasProperty(lastReportedFileNames, id)) { | ||
added.push(id); | ||
|
@@ -691,7 +702,7 @@ namespace ts.server { | |
} | ||
this.lastReportedFileNames = currentFiles; | ||
this.lastReportedVersion = this.projectStructureVersion; | ||
return { info, changes: { added, removed }, projectErrors: this.projectErrors }; | ||
return { info, changes: { added, removed, updated }, projectErrors: this.projectErrors }; | ||
} | ||
else { | ||
// unknown version - return everything | ||
|
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
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.
minor nit to reduce allocations:
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.
clever - testing this change and will update