Wikitext-VSCode-Extension icon indicating copy to clipboard operation
Wikitext-VSCode-Extension copied to clipboard

Allow changing default `.wikitext` file extension to something else

Open Openstreetmapler opened this issue 7 months ago • 6 comments

I always find it quite annoying when I create a new wikitext file and then, when I save it, I always have to edit the file extension to be .wiki instead of .wikitext – there’s no setting to permanently set the file extension!

Openstreetmapler avatar May 26 '25 17:05 Openstreetmapler

I looked through the VSCode API documentation, but didn't find any settings or configurations for it. So it seems that this is not feasible, and VSCode will always get the first one in extensions as the default file extension.

Frederisk avatar May 29 '25 00:05 Frederisk

Should I open an issue about this in the VSCode repository?

Openstreetmapler avatar May 29 '25 15:05 Openstreetmapler

Maybe? I looked around in the VSCode issues page but couldn't seem to find an existing issue for this, not sure if I'm missing something.

Frederisk avatar May 30 '25 09:05 Frederisk

VSCode will always get the first one in extensions as the default file extension.

[!TIP] Instead of $${\color{red}un \color{black}wished \space \color{red}long}$$ file extension ~~.wikitext~~, changing the order of file extensions in package.json defaults the file extension to $${\color{green}shorter}$$ .wiki

In File Explorer

  1. Browse folder %UserProfile%\.vscode\extensions\rowewilsonfrederiskholme.wikitext-4.0.2
  2. Backup package.json

In VSCode

  1. Edit package.json
  2. Move the String ".wiki" in first position.
  3. Add a comma after the String.
  4. Remove the ending ~~comma~~ in ".mw"$${\color{red},}$$
  5. The expected JSON should be:
		"languages": [
			{
				"id": "wikitext",
				"extensions": [
					".wiki",
					".wikitext",
					".wt",
					".mediawiki",
					".mw"
				],

In VSCode menu View > Extensions > Wikitext

  1. Click wheel ☸ Manage > 🛑 $${\color{red}Disable}$$
  2. Click $${\color{blue}Restart \space Extensions}$$
  3. Click wheel ☸ Manage > 🟢 $${\color{green}Enable}$$
  4. Click menu File > Save As > <%-- [PAGE_INFO] Untitled-1
  5. Filename: Untitled-1.wiki
  6. Rename Untitled-1 keeping the file extension.

AlSchemist avatar Sep 06 '25 19:09 AlSchemist

Huge thanks @AlSchemist for your comment, it solved the issue for me! @Frederisk Should I close this issue now?

Openstreetmapler avatar Sep 19 '25 14:09 Openstreetmapler

Editing the source code is indeed a solution to the problem. However, it should be noted that every time the extension is updated, your changes will be overwritten. The good news is that this extension tends to be stable, so updates are not very frequent.

I tend to think that this issue has not been completely resolved, but you are free to choose to close it.

Frederisk avatar Sep 20 '25 07:09 Frederisk