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

Merge add/remove functions into a single update/splice functions #42481

Closed
jrieken opened this issue Jan 30, 2018 · 5 comments
Closed

Merge add/remove functions into a single update/splice functions #42481

jrieken opened this issue Jan 30, 2018 · 5 comments
Assignees

Comments

@jrieken
Copy link
Member

jrieken commented Jan 30, 2018

re #42321

I believe this is very similar to modifying workspace folders which started with add/remove functions and ended with a single update function. The update allows for more operations, like re-arrange and removal/addition in one call.

fti @bpasero

@weinand
Copy link
Contributor

weinand commented Jan 31, 2018

For breakpoints the order is irrelevant so "re-arrange" is not a useful operation. In addition the "splice" operation does not support deletion of arbitrary elements (only deletion of consecutive ranges).

"splice" style API works fine for everything that is manipulated in ranges, e.g. text, or text-lines, and may be even workspace folders if their order is an important characteristic that results in many range-based operations.

After having used the "updateWorkspaceFolders" for testing #42195 I know for sure sure that I do not want to use this API for breakpoints.

@weinand weinand closed this as completed Jan 31, 2018
@jrieken
Copy link
Member Author

jrieken commented Jan 31, 2018

Well, now the two of you better talk

@weinand
Copy link
Contributor

weinand commented Jan 31, 2018

See my question #42642.
May be I'm missing something...

@bpasero
Copy link
Member

bpasero commented Jan 31, 2018

I used to have a simple add/remove API but @alexandrudima filed #37301 so I think he should also chime in to give feedback on splice API vs. add/remove API. I am fine either way, I think what we are "working around" is the fact that an extension cannot make changes to the array directly, so we come up with methods that provide similar functionality.

@weinand
Copy link
Contributor

weinand commented Jan 31, 2018

We do not need a general discussion about splice vs. add/remove API. There are pros and cons for both API styles in different situations.

I have no problems with using the splice API for workspace folders because folders have an index and replacing folders for rename purposes profit from splice.

But I do not want to use splice for the breakpoints API.

Alex's arguments from #37301 do not apply for breakpoints:

  • addBreakpoints and removeBreakpoints both take arrays of breakpoints,
  • there is no need for "replace" functionality because breakpoints do not have an index and their order in the array is irrelevant. So replacing breakpoints does not make any sense.
  • bulk removing breakpoints is important but those breakpoints live in random locations of the breakpoints array so a splice operation is completely useless in this case.

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants