I’m creating a ChatGPT “editor” in VS Code where you can have a chat window open not unlike the one OpenAI created for ChatGPT. I don’t have any problems with creating the editor or saving and loading documents per se, but if I create a new document and then save it the save dialog defaults the file type to json and not the extension I created for the file – the extension I created isn’t even in the save as type dropdown. It is json behind the scenes, but I don’t want it to automatically save as json. I don’t want to manually register a type in VS Code, instead I want this to all link up and work from having the extension installed and enabled.
My goal is that when I create a new gpt document and try to save it (e.g. create new document and immediately press Ctrl+S) that the save dialog box will recognize this as a “gpt” document instead of a “json” document.
I tried configuring the customEditors section of the package.json file as it is in the supplied sample:
"customEditors": [
{
"viewType": "sfcodegpt.chat",
"displayName": "GPT",
"selector": [
{
"filenamePattern": "*.gpt"
}
]
}
]
That didn’t work
I tried adding in a languages tag to extend it to *.gpt:
"languages": [
{
"id": "json",
"extensions": [
".gpt"
],
"aliases": [
"Chat GPT Book"
]
}
]
That didn’t work.
I don’t know how to make this work and looking at documentation, samples, and googling I can’t find anything on this specific thing. I don’t even know if I need to code something/update my CustomTextEditorProvider dervied class or if it’s config somewhere.