8

While writing a comment in .ini files, VS Code gives me the comment ; when what I need is a #. Is there a setting somewhere where I can replace that character?

This is similar issue but not a duplicate of the following post, as I am not editing assembly and the extension provided does not work: How to customize comment character in Visual Studio Code?

user2558717
  • 81
  • 1
  • 3
  • You would have to modify `package.json` from that extension in order to achieve what you want. – Ramhound Jan 26 '22 at 19:18
  • I tried multiple .ini editors. Sadly, none of them have such a setting in their package.json – user2558717 Jan 26 '22 at 20:43
  • 1
    Ok; Apparently you didn’t understand. You would have to edit the package.json, and the .ini file to the list of file extensions, then modify the other .json file to define the comment character. – Ramhound Jan 26 '22 at 22:44
  • 2
    That worked! So to reiterate, I needed to: 1) Install https://github.com/13xforever/x86_64-assembly-vscode 2) Find the extension under ~/.vscode/extensions 3) Modify package.json to include .ini under extensions. 4) Modify language-configuration.json, under lineComment replace ";" with "#" Thank you Ramhound for your help. – user2558717 Jan 27 '22 at 19:09

2 Answers2

2

The easiest way around this I've found is to associate .ini files with Shell Script instead of Ini - then you can toggle comments using '#'.

Do Ctrl+Shift+P, Change Language Mode, then Configure File Association for '.ini', and select Shell Script.

Brian Burns
  • 700
  • 8
  • 14
1

As noted here, change the language mode to Properties rather than Ini. Look in the status bar to see whether the language is "Ini" (lineComment ;) or "Properties" (lineComment #).

crimson-egret
  • 3,276
  • 17
  • 20