0

I'm using VSCode and have the official Microsoft C# extension installed. Can't seem to figure out how to edit Omnisharp's formatting rules.

I have an 'omnisharp.json' file in the root of my directory, right next to the .sln file, but no changes I make in the JSON seem to affect the formatting in VSCode. I was under the impression that the project-specific omnisharp file would override any others that might be lurking around on my machine.

Extra Context:

  • The Omnisharp output window has shown this message.
  • Also getting a warning in the Omnisharp output window:

warn: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService No symbol found. File: file\path\here.cs, Line: 51, Column: 16.

  • The 'EnableEditorConfigSupport' setting is set to false in the JSON and is unchecked in VSCode's settings.
  • To test if a solution has worked or not, I've been editing the omnisharp.json file so that many of the settings are drastically changed and would be easily noticeable, restarting Omnisharp using the OmniSharp: Restart OmniSharp command in VSCode, then formatting a couple of files to see if anything changes.
  • Using this configuration
  • I do not have the EditorConfig extension installed

What I've tried/read:

What hasn't worked:

  • Creating an omnisharp.json file in the same folder as the solution as well as the %APPDATA%/Code/User folder, the %userprofile%/.omnisharp folder, and the %userprofile%/.vscode/extensions/ms-dotnettools.csharp-1.25.7-win32-x64/.omnisharp/1.39.6-net6.0 folder.
  • Setting EnableEditorConfigSupport to false in all omnisharp.json files and in all settings.json files.
  • Completely uninstalling VSCode (deleting all user settings in the process), reinstalling the latest version of VSCode, reinstalling the latest version of .NET, and re-trying the above steps.
  • Changing Unity's VSCode Editor Package to version 1.2.3
  • Creating a config.json file and using this configuration
  • Installing Mono
  • Installing MSBuildTools
  • Setting omnisharp.UseModernNet to false in the settings.json file in the project, user, and Code folders
  • Installing .NET 6

Been wandering around the web for a couple of hours trying to solve this and nothing seems to work so far so, any help figuring out why this isn't working would be appreciated. Happy to provide any additional context or information if needed.

Stochastis
  • 11
  • 3
  • Thank you for the suggestion. Is there anything else I could add/change to make the question easier to read/understand? – Stochastis May 17 '23 at 21:29
  • at what scope did you set the VS Code `omnisharp.enableEditorConfigSupport` setting to `false`? User scope or workspace scope? I wonder if something at a different scope sets it to `true`. Check your user settings.json file and your workspace settings.json file (if you have one). https://code.visualstudio.com/docs/getstarted/settings#_settingsjson – starball May 17 '23 at 21:40
  • I have used the omnisharp.json file with the enableEditorConfigSupport set to false in the %APPDATA%/Code/User folder as well as the workspace itself right next to the sln file. I do not have a settings.json file in the workspace, but the one in %APPDATA%/Code/User is set to false as well. – Stochastis May 18 '23 at 03:08
  • 1) try putting `"enableEditorConfigSupport": false` in your _settings.json_ file instead (not in omnisharp.json)- either at the user scope (`Preferences: Open User Settings (JSON)` command in command palette), or at workspace scope (in the workspace's `.vscode/settings.json` file). 2) also, is the solution file in the root of the workspace folder? (and you omnisharp.json file as well?) – starball May 18 '23 at 03:20
  • 1) All four files (omnisharp.json in appdata and workspace and settings.json in appdata and workspace) have enableEditorConfigSupport set to false. No change in formatting. 2) The sln file is on the same level as the .config, .vs, .vscode, and assets folders as well as all of the Unity.something files. – Stochastis May 18 '23 at 03:38

0 Answers0