-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Feature Request: Allow Custom Editors To Gracefully Handle Diff Views #138525
Comments
#171381 is slightly different. we want to use a new webview to do the compare |
It would be nice if the user could have control over this using the Related on Stack Overflow: |
Set default editor for diff viewWe can use Text editor diff view: {
"configurationDefaults": {
"workbench.editorAssociations": {
"{git,gitlens}:/**/*.{drawio,dio,dio.svg,drawio.svg}": "default",
}
}
} Image preview diff view: {
"configurationDefaults": {
"workbench.editorAssociations": {
"{git,gitlens}:/**/*.{bmp,dib,ico,png,jif,jpe,jpg,jpeg,tga,tpic,webp}": "imagePreview.previewEditor",
}
}
} Set different custom editor for diff view and edit view{
"configurationDefaults": {
"workbench.editorAssociations": {
"{git,gitlens}:/**/*.custom-ext": "custom-diff-editor",
}
},
"customEditors": [
{
"viewType": "custom-editor",
"displayName": "custom-editor",
"selector": [
{
"filenamePattern": "*.custom-ext"
}
],
"priority": "default"
},
{
"viewType": "custom-diff-editor",
"displayName": "custom-diff-editor",
"selector": [
{
"filenamePattern": "*.custom-ext"
}
],
"priority": "option"
}
]
} ExamplePS: Currently it seems some bug with |
Fix TranquilMarmot#19 `configurationDefaults` with `workbench.editorAssociations` should work fine use in `VS Code 1.86.0`. See: microsoft/vscode#138525 (comment)
…1268) # [vscode][ez] Use Default Diff View for .aiconfig.json/yaml Diff View Following the example outlined in microsoft/vscode#138525 (comment) to make the view for diff-related views (noted by `git`, `gitlens`, `sapling-diff` as schema at the start of the document URI) fall back to the default diff view https://github.com/lastmile-ai/aiconfig/assets/5060851/258d5ae6-d5f8-497d-8a99-c44e9be579c1
I found the final solution, which is surprisingly simple, and I think this issue can be closed. {
"viewType": "viewType",
"displayName": "Custom Editor",
"selector": [
{
"filenamePattern": "file:/**/*.ext"
}
]
} |
@cweijan , Could you elaborate? Where should this json be configured? |
@cweijan thanks for your feedback. But I think this is not the solution for the problem. The configuration you mentioned is the general mapping for a file extension and your custom editor. We also use this in our Open-BPMN project to link But the question is: How can I overwrite this editor linking for the Diff-Compare View? This is another editor type in vs-code that overtakes the default mappings. |
Hi, thanks for your answer. It seems that I am not able to follow your suggestions here. My example was a deep configuration detail in my extension code itself. This is to associate my own extension (providing a custom editor) with a specific file extension. And this all works fine. So I can open a But with this configuration in case of a GIT staging situation the Diff Editor View open two graphical editors. And this is what I want to avoid: @zjffun mentioned something like the following using the priority option: "customEditors": [
{
"viewType": "custom-editor",
"displayName": "custom-editor",
"selector": [
{
"filenamePattern": "*.custom-ext"
}
],
"priority": "default"
},
{
"viewType": "custom-diff-editor",
"displayName": "custom-diff-editor",
"selector": [
{
"filenamePattern": "*.custom-ext"
}
],
"priority": "option"
} But what I did not understand here is the view type |
@rsoika @hanjoosten Sorry I didn't explain it clearly. The key point is Note that this needs to be done by the extension developer. |
@cweijan I still did not get it. I am the extension developer. I do not have the problem that my editor is not opened. I just want to define an optional different editor for the Diff compare view. Is this possible? |
@rsoika This is possible, replace your |
@rsoika We can use |
It would be awesome if custom editors could influence the diff view (or opt out of it).
These are examples where the default diff view does not really work:
Unfortunately, the individual custom editor only knows if it is readonly, but not if it is right or left of a diff view.
Related:
.yarn
files should default to the built-in Text Editor, not the Yarn Loom editor TranquilMarmot/YarnLoom#19The text was updated successfully, but these errors were encountered: