Skip to content
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

Use void instead CustomDocumentContentChangeEvent #95849

Closed
jrieken opened this issue Apr 22, 2020 · 3 comments
Closed

Use void instead CustomDocumentContentChangeEvent #95849

jrieken opened this issue Apr 22, 2020 · 3 comments
Assignees
Labels
api custom-editors Custom editor API (webview based editors) on-testplan
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Apr 22, 2020

Using marker interfaces in a structurally typed language like TypeScript has zero value. It cannot be told apart other empty things and makes it more cumbersome for extension authors. For custom documents and the onDidChange-event it is enough to have this

readonly onDidChange: Event<void> | Event<CustomDocumentEditEvent> 
@jrieken jrieken added this to the April 2020 milestone Apr 22, 2020
@jrieken jrieken added custom-editors Custom editor API (webview based editors) api labels Apr 22, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 22, 2020

Structurally yes it doesn't add anything, but it lets us document the event and the interface can be extended if needed in the future

Can you explain how it be more any cumbersome for extension authors?

@jrieken
Copy link
Member Author

jrieken commented Apr 23, 2020

Can you explain how it be more any cumbersome for extension authors?

Sure. First, it is a new concept which we have never used before and that by itself adds complexity. Then, you need to write emitter.fire({}) instead of emitter.fire() - the ladder is enough to express what we need to know - which in return means the former isn't needed.

Ideally TS would allow us to define these as overload instead of or-types. That would make the whole documentation indirection obsolete.

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 23, 2020

I don't think you can document overloads of a property in TS> All the documentation will have to go into one documentation block

The current API is what we agreed to as a group. It's fine with me to switch it, but I want to make sure we have thought it through. The current design also has the advantages I noted: documentation and extensibility if needed

@mjbvz mjbvz closed this as completed in 4862602 Apr 24, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api custom-editors Custom editor API (webview based editors) on-testplan
Projects
None yet
Development

No branches or pull requests

2 participants