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

FR: Provide a cause for the onDidChangeTextDocument #36939

Closed
Chillee opened this issue Oct 25, 2017 · 6 comments
Closed

FR: Provide a cause for the onDidChangeTextDocument #36939

Chillee opened this issue Oct 25, 2017 · 6 comments
Assignees
Labels
api *duplicate Issue identified as a duplicate of another issue(s) under-discussion Issue is under discussion for relevance, priority, approach

Comments

@Chillee
Copy link

Chillee commented Oct 25, 2017

It would be very helpful for to provide a kind/cause attribute for the TextDocumentChangeEvent, similar to the one provided for TextEditorSelectionChangeEvent.

@rebornix

@jrieken
Copy link
Member

jrieken commented Oct 26, 2017

Sorry, not possible with breaking the API. The event is specified as just the editor, no place for extra information.

@jrieken jrieken added the under-discussion Issue is under discussion for relevance, priority, approach label Oct 26, 2017
@Chillee
Copy link
Author

Chillee commented Oct 26, 2017

Sorry, I'm a bit confused what you mean by breaking the API. What do you mean by "the event is specified as just the editor"? It already contains both the document and the contentChanges, no? There also seems to an already be an identifier property on IIdentifiedSingleEditOperation, so I'd imagine you could piggy back on that.

For example, the important thing for me is that replace is able to accept some kind of parameter that allows me to know where the change is coming from. So I'd imagine that I could just pass a string or something that is then propogated down the actual changeEvent here

Basically, my use case is that when I copy text over from Neovim, I have to replace the entire buffer. Usually, when there's a TextDocumentChangeEvent from VSCode, I sync that over to Neovim, but in this case, it can cause a race.

As in, the typical passing of data is (Neovim -> VSCode), then due to the TextDocumentChangeEvent, we have to do (VSCode -> Neovim). We have no way of knowing that the TextDocumentChangeEvent we're capturing is due to us, so we have to recopy.

Now, if Neovim sends data twice, we have a race between handling the first TextDocumentChangeEvent and passing the data from Neovim -> VSCode the second time.

@eamodio
Copy link
Contributor

eamodio commented Oct 26, 2017

@Chillee I think your title is wrong -- I think you meant onDidChangeTextDocument not onDidChangeActiveTextEditor

@Chillee
Copy link
Author

Chillee commented Oct 26, 2017

@eamodio oh whups you're completely right. I see what you mean now @jrieken haha.

@Chillee Chillee changed the title FR: Provide a cause for the onDidChangeActiveTextEditor FR: Provide a cause for the onDidChangeTextDocument Oct 26, 2017
@jrieken
Copy link
Member

jrieken commented Oct 27, 2017

haha, I should read more than the title. A dupe of #10801 (closed) because we actually don't know what's caused the change

@jrieken jrieken closed this as completed Oct 27, 2017
@jrieken jrieken added the *duplicate Issue identified as a duplicate of another issue(s) label Oct 27, 2017
@Chillee
Copy link
Author

Chillee commented Oct 27, 2017

@jrieken I don't actually need to know it in the general case, I just need to know it for text edits that my extension is causing. It's a similar case for the remote editing plugin that the issue linked has.

For this more limited case, is it not possible using an approach similar to what I mentioned in the comment? I could try hacking something if it's something that might be feasibly merged.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api *duplicate Issue identified as a duplicate of another issue(s) under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

3 participants