-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Allow language inheritance (i.e. SVG extends XML) #3052
Conversation
Rebased onto #3051 |
Rebased |
Includes #3164 so I could at least switch to my branch without git thinking I changed a translation file. |
return LanguageManager.defineLanguage(definition.id, def); | ||
if (def.lineComment) { | ||
def.lineComment = def.lineComment.prefix; | ||
} |
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.
This block shouldn't be needed anymore, since now def.lineComment
is always defined as a string or an array, and not an object with a prefix key in it.
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.
Ah, true. Thanks!
Rebased, now without the Chinese translation issues. |
Will merge again once #3285 has landed, not before. |
Conflicts: src/language/LanguageManager.js
Merged master. Next merge only after being prompted. |
Sorry for the delay Dennis! We tagged this for review in the architecture meeting to get the ball rolling. |
Reviewed in architecture meeting. Should add a new |
@DennisKehrig do you have cycles to add the |
Hmm, although I just realized another tricky area: some code uses language ids in a map, e.g. CodeHintManager. We'll need to update that code to traverse the language 'inheritance chain' and aggregate together all the map results rather than doing the simple single lookup it does today... |
maybe there should be a utility function to do that. |
@peterflynn I will get to that later today! |
Conflicts: test/spec/LanguageManager-test.js
@peterflynn: I tried to require the LanguageManager in HintUtils.js, but I keep getting an error that |
@peterflynn All done! |
@DennisKehrig Sorry for letting this languish for so long. After thinking about this for a few days, I believe we're not yet at a point where we need to introduce this concept into LanguageManager. Many of the use cases for this in practice are simple enough to be handled via existing APIs -- e.g. an SVG code hint provider could register for "xml" generally but only respond in SVG files. In the past year we haven’t hit any cases that were really blocked by this. If extensions start commonly providing much richer support for specific sub-languages in the future, it seems like we'd need to consider something like this. But we're not there yet, and in the meantime this adds a certain amount of complexity and makes dealing with language ids more error-prone (it's tempting to use them with ==, Closing for now, but we will definitely revive this patch if needed down the road -- it's not forgotten :-) And thanks for all the effort & thought you put into this already! |
Fixes #3044
[now in master] Depends on / contains #3051 (Made Language.addFileExtension public)