-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Consider referencing xterm.d.ts from internal types to reduce doc repetition #4663
Comments
One problem I have dealing with the code is that there are so many classes and interfaces that are variations of each other, aliases of each other, or implement/extend each other. There is a lot of abstraction - which has its benefits, but it makes the code harder to understand. For example there are five declarations of Without discussing proposal 1 on its merits (which I don't think I'm ready to do), it has the disadvantage that it increases the abstraction penalty and adds yet more type names. So that is definitely a disadvantage. |
I'm not sure if we document it properly but the abstraction makes a lot more sense when you look at it in terms of the layer sub-projects (which enables xterm-headless). The
There's a diagram around here somewhere that shows this as a diagram that we should stick in the wiki. This pattern (and others) are also very similar to how it works in VS Code's codebase so it's pretty natural when you're coming from there which I imagine a decent chunk of contributors do. It could always be improved and there are some efforts that are half completed and a bit messy (like the services/ folder which I've kind of changed my mind about). It's nicer when you consider it used to be a single 6000 line file without types that was a real struggle to maintain and improve. |
From @PerBothner's suggestion in #4519 (comment)
Right now we often either don't have docs linked to internal types (making development harder, especially for new contributors) or duplicate the docs which of course can easily suffer bitrot.
One solution is to reference
xterm
and then extendPick<Terminal, 'apis'>
like this:If we do this we would want some rules around the usage, here are some ideas using
Terminal.selectAll()
/ISelectionService.selectAll()
as an example.1: Pull in any types referenced to a special types file
Example:
ApiTypes.ts
Services.ts
2: Pull in directly from the API
Services.ts
I think 1 is probably the nicest unless there are other ideas because:
IApi*
types areTerminal as IApiTerminal
import manually when a file hasn't referenced it yetvs
The text was updated successfully, but these errors were encountered: