6

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?

4
  • You would have to modify package.json from that extension in order to achieve what you want.
    – Ramhound
    Jan 26, 2022 at 19:18
  • I tried multiple .ini editors. Sadly, none of them have such a setting in their package.json Jan 26, 2022 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, 2022 at 22:44
  • 2
    That worked! So to reiterate, I needed to: 1) Install 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. Jan 27, 2022 at 19:09

2 Answers 2

1

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.

1
  • Changing the language mode to a shellscript loses all the other formatting goodness. Not terribly helpful. Dec 13, 2022 at 21:45
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 #).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.