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

Git: Failed to show text document , should show in editor #undefined #96397

Closed
bpasero opened this issue Apr 28, 2020 · 9 comments
Closed

Git: Failed to show text document , should show in editor #undefined #96397

bpasero opened this issue Apr 28, 2020 · 9 comments
Assignees
Labels
api custom-editors Custom editor API (webview based editors) notebook

Comments

@bpasero
Copy link
Member

bpasero commented Apr 28, 2020

Refs: #96279

image

I got this by clicking on the "Open File" quick action from the Git changes view.

@bpasero bpasero added notebook web Issues related to running VSCode in the web labels Apr 28, 2020
@jrieken
Copy link
Member

jrieken commented Apr 28, 2020

@joaomoreno Is the git extension using the showTextDocument-API and not the vscode.open-command?

@jrieken
Copy link
Member

jrieken commented Apr 28, 2020

Oh, I see:

document = await workspace.openTextDocument(uri);
} catch (error) {
await commands.executeCommand<void>('vscode.open', uri, opts);
continue;
}
// Check if active text editor has same path as other editor. we cannot compare via

Git is using the fact that a text document can be created as hint for opening a text editor. This will then also apply all custom text editors (fyi @mjbvz) and I feel that the API should always open a text editor then...

@joaomoreno
Copy link
Member

joaomoreno commented Apr 28, 2020

I've called every possible method in our API/commands to be able to open documents from the git extension. The current approach is probably already the 53rd iteration.

Please just tell me what I should do there and I'll add a comment in there saying who suggested it, for the next time I have to change this.

@jrieken jrieken assigned bpasero and mjbvz and unassigned joaomoreno, rebornix and jrieken Apr 28, 2020
@jrieken jrieken added api custom-editors Custom editor API (webview based editors) and removed notebook web Issues related to running VSCode in the web labels Apr 28, 2020
@jrieken
Copy link
Member

jrieken commented Apr 28, 2020

Yeah, git isn't to blame. This is two problems

  • the showTextDocument-API must overrule the custom editor settings and always open a text editor
  • there is no API to do the right thing, like open this URI with potentially these options

@rebornix rebornix self-assigned this Apr 28, 2020
@bpasero
Copy link
Member Author

bpasero commented Apr 30, 2020

@jrieken

the showTextDocument-API must overrule the custom editor settings and always open a text editor

We have a ignoreOverrides editor option that we could simply add to this options bag [1]

there is no API to do the right thing, like open this URI with potentially these options

Can you clarify what API is needed, wasn't sure I understand that message.

[1]

const editorOptions: ITextEditorOptions = {
preserveFocus: options.preserveFocus,
pinned: options.pinned,
selection: options.selection,
// preserve pre 1.38 behaviour to not make group active when preserveFocus: true
// but make sure to restore the editor to fix https://github.com/microsoft/vscode/issues/79633
activation: options.preserveFocus ? EditorActivation.RESTORE : undefined
};

@jrieken
Copy link
Member

jrieken commented Apr 30, 2020

The showTextDocument-API has guarantee that it opens a text editor or errors. Therefore we cannot make it open a custom editor and need an API which doesn't return anything but accepts the union of all editor options. Like, open this uri as any editor, if it's a text editor use these options, if it's a foo editor use these options etc

@jrieken
Copy link
Member

jrieken commented Apr 30, 2020

We have a ignoreOverrides editor option that we could simply add to this options bag [1]

👍 thanks. I have pushed a change that uses this flag

@bpasero
Copy link
Member Author

bpasero commented Apr 30, 2020

Sounds good. I feel that we should then close this issue for the actual bug I filed and be able to verify it and have a new issue for the new API.

@jrieken
Copy link
Member

jrieken commented Apr 30, 2020

Agreed - I'd say we fold the API request into the "expose editor tab model api request"

@jrieken jrieken closed this as completed Apr 30, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 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) notebook
Projects
None yet
Development

No branches or pull requests

5 participants