This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Made Language.addFileExtension public #3051
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ba472a3
Made Language.addFileExtension public, added a languageModified event…
DennisKehrig e339205
Update the language name if the language changes
DennisKehrig 5208f1b
Forgot some places that should make the language as modified
DennisKehrig f1c7824
Remove runs(...) in LanguageManager-test.js where it is unnecessary
DennisKehrig 4d0ea86
Merge branch 'master' into dk/issue-2966
DennisKehrig 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,6 +404,46 @@ define(function (require, exports, module) { | |
}); | ||
}); | ||
|
||
it("should update the document's language when a language is modified", function () { | ||
var unknown, | ||
doc, | ||
spy, | ||
modifiedLanguage, | ||
promise; | ||
|
||
runs(function () { | ||
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. Wrapping this in a 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. Fixed |
||
// Create a shell script file | ||
doc = SpecRunnerUtils.createMockActiveDocument({ filename: "test.foo" }); | ||
|
||
// Initial language will be unknown (shell is not a default language) | ||
unknown = LanguageManager.getLanguage("unknown"); | ||
|
||
// listen for event | ||
spy = jasmine.createSpy("languageChanged event handler"); | ||
$(doc).on("languageChanged", spy); | ||
|
||
// sanity check language | ||
expect(doc.getLanguage()).toBe(unknown); | ||
|
||
// make active | ||
doc.addRef(); | ||
|
||
modifiedLanguage = LanguageManager.getLanguage("html"); | ||
modifiedLanguage.addFileExtension("foo"); | ||
|
||
// language should change | ||
expect(doc.getLanguage()).toBe(modifiedLanguage); | ||
expect(spy).toHaveBeenCalled(); | ||
expect(spy.callCount).toEqual(1); | ||
|
||
// check callback args (arg 0 is a jQuery event) | ||
expect(spy.mostRecentCall.args[1]).toBe(unknown); | ||
expect(spy.mostRecentCall.args[2]).toBe(modifiedLanguage); | ||
|
||
// cleanup | ||
doc.releaseRef(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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.
Is this useful to notify when the comment markup changes? I appreciate the completeness but I don't think there should be anything actionable unless for some reason a client cached the comment markup values.
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.
It is for completion... I have a hard time coming up with use cases, too. But it's also a non-issue since the languageModified event is only triggered for languages that are already registered, so this would only happen for languages that get different comment settings after having been defined.
Would you prefer to have it removed?
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.
Nope, it's fine as-is. Thanks.