From 48c53edea7eb365bb4253ba6d258d7867add485a Mon Sep 17 00:00:00 2001 From: Abdul-Kadir Coskun Date: Sun, 6 Aug 2023 13:47:50 +1000 Subject: [PATCH] Remove omnisharp config generation --- CHANGELOG.md | 6 ++ Editor/ConfigGeneration/ConfigGeneration.cs | 64 +------------------ Editor/Utils/FlagHandler.cs | 7 +- Editor/VSCodeScriptEditor.cs | 71 --------------------- package.json | 2 +- 5 files changed, 9 insertions(+), 141 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb29e0..8ad805f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Code Editor Package for Visual Studio Code +## [1.4.7] - 2023-08-06 + +- Remove omnisharp config generation from package +- Clean up code and remove unused directives +- Update .gitignore to remove .omnisharp.json ignore + ## [1.4.6] - 2023-08-06 - Added ignore IDE0051 to .editorconfig default configuration diff --git a/Editor/ConfigGeneration/ConfigGeneration.cs b/Editor/ConfigGeneration/ConfigGeneration.cs index 150eac1..70345d3 100644 --- a/Editor/ConfigGeneration/ConfigGeneration.cs +++ b/Editor/ConfigGeneration/ConfigGeneration.cs @@ -1,16 +1,5 @@ -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Security; -using System.Security.Cryptography; -using System.Text; -using System.Xml.Linq; using UnityEditor; -using UnityEditor.Compilation; -using UnityEngine; -using UnityEngine.Profiling; -using SR = System.Reflection; namespace VSCodeEditor { @@ -18,7 +7,6 @@ public interface IConfigGenerator { string VSCodeSettings { get; set; } string WorkspaceSettings { get; set; } - string OmniSharpSettings { get; set; } string EditorConfigSettings { get; set; } string ProjectDirectory { get; } IFlagHandler FlagHandler { get; } @@ -82,10 +70,7 @@ public class ConfigGeneration : IConfigGenerator ""ProjectSettings/"":true, ""temp/"":true, ""Temp/"":true - }, - ""omnisharp.useModernNet"": true, - ""omnisharp.sdkIncludePrereleases"": false, - ""omnisharp.organizeImportsOnFormat"": true + } }"; const string k_DefaultWorkspaceJson = @@ -98,24 +83,6 @@ public class ConfigGeneration : IConfigGenerator ] }"; - const string k_DefaultOmniSharpJson = - /*lang=json,strict*/ - @"{ - ""RoslynExtensionsOptions"": { - ""EnableAnalyzersSupport"": true, - ""AnalyzeOpenDocumentsOnly"": true, - ""DocumentAnalysisTimeoutMs"": 600000 - }, - ""FormattingOptions"": { - ""enableEditorConfigSupport"": true - }, - ""RenameOptions"": { - ""RenameInComments"": true, - ""RenameOverloads"": true, - ""RenameInStrings"": true - } -}"; - const string k_DefaultEditorConfig = @"# EditorConfig is awesome: http://EditorConfig.org @@ -139,7 +106,6 @@ public class ConfigGeneration : IConfigGenerator string m_VSCodeSettings; string m_WorkspaceSettings; - string m_OmniSharpSettings; string m_EditorConfigSettings; public string VSCodeSettings @@ -176,23 +142,6 @@ public string WorkspaceSettings } } - public string OmniSharpSettings - { - get => - m_OmniSharpSettings ??= EditorPrefs.GetString( - "vscode_omnisharpSettings", - k_DefaultOmniSharpJson - ); - set - { - if (value == "") - value = k_DefaultOmniSharpJson; - - m_OmniSharpSettings = value; - EditorPrefs.SetString("vscode_omnisharpSettings", value); - } - } - public string EditorConfigSettings { get => @@ -232,7 +181,6 @@ public void Sync() { WriteVSCodeSettingsFiles(); WriteWorkspaceFile(); - WriteOmniSharpConfigFile(); WriteEditorConfigFile(); } @@ -264,16 +212,6 @@ void WriteWorkspaceFile() } } - void WriteOmniSharpConfigFile() - { - if (m_FlagHandler.ConfigFlag.HasFlag(ConfigFlag.OmniSharp)) - { - var omniSharpConfig = Path.Combine(ProjectDirectory, "omnisharp.json"); - - m_FileIOProvider.WriteAllText(omniSharpConfig, OmniSharpSettings); - } - } - void WriteEditorConfigFile() { if (m_FlagHandler.ConfigFlag.HasFlag(ConfigFlag.EditorConfig)) diff --git a/Editor/Utils/FlagHandler.cs b/Editor/Utils/FlagHandler.cs index b996aff..099d93c 100644 --- a/Editor/Utils/FlagHandler.cs +++ b/Editor/Utils/FlagHandler.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using UnityEditor; -using UnityEditor.Compilation; -using UnityEditor.PackageManager; namespace VSCodeEditor { @@ -20,8 +16,7 @@ public enum ConfigFlag None = 0, VSCode = 1, Workspace = 2, - OmniSharp = 4, - EditorConfig = 8, + EditorConfig = 4, } [Flags] diff --git a/Editor/VSCodeScriptEditor.cs b/Editor/VSCodeScriptEditor.cs index 0282006..f9e9deb 100644 --- a/Editor/VSCodeScriptEditor.cs +++ b/Editor/VSCodeScriptEditor.cs @@ -4,7 +4,6 @@ using System.Linq; using Unity.CodeEditor; using UnityEditor; -using UnityEditor.PackageManager; using UnityEngine; namespace VSCodeEditor @@ -23,12 +22,10 @@ public class VSCodeScriptEditor : IExternalCodeEditor bool m_ShowProjectSection = true; bool m_ShowVSCodeSettingsSection = false; bool m_ShowWorkspaceSection = false; - bool m_ShowOmniSharpSection = false; bool m_ShowEditorConfigSection = false; Vector2 m_VSCodeScrollPosition; Vector2 m_WorkspaceScrollPosition; - Vector2 m_OmniSharpScrollPosition; Vector2 m_EditorConfigScrollPosition; readonly IDiscovery m_Discoverability; @@ -114,52 +111,6 @@ bool ShowProjectSection } } - bool ShowVSCodeSettingsSection - { - get => - m_ShowVSCodeSettingsSection - || EditorPrefs.GetBool("vscode_showVSCodeSettingsSection", false); - set - { - m_ShowVSCodeSettingsSection = value; - EditorPrefs.SetBool("vscode_showVSCodeSettingsSection", value); - } - } - - bool ShowWorkspaceSection - { - get => - m_ShowWorkspaceSection || EditorPrefs.GetBool("vscode_showWorkspaceSection", false); - set - { - m_ShowWorkspaceSection = value; - EditorPrefs.SetBool("vscode_showWorkspaceSection", value); - } - } - - bool ShowOmniSharpSection - { - get => - m_ShowOmniSharpSection || EditorPrefs.GetBool("vscode_showOmniSharpSection", false); - set - { - m_ShowOmniSharpSection = value; - EditorPrefs.SetBool("vscode_showOmniSharpSection", value); - } - } - - bool ShowEditorConfigSection - { - get => - m_ShowEditorConfigSection - || EditorPrefs.GetBool("vscode_showEditorConfigSection", false); - set - { - m_ShowEditorConfigSection = value; - EditorPrefs.SetBool("vscode_showEditorConfigSection", value); - } - } - static string[] DefaultExtensions { get @@ -337,22 +288,6 @@ ref m_VSCodeScrollPosition ref m_WorkspaceScrollPosition ); - FlagButton( - ConfigFlag.OmniSharp, - "OmniSharp", - "", - (handler, flag) => handler.ConfigFlag.HasFlag(flag), - (handler, flag) => handler.ToggleConfig(flag) - ); - - if (m_ConfigGeneration.FlagHandler.ConfigFlag.HasFlag(ConfigFlag.OmniSharp)) - RenderSettingsSection( - ref m_ShowOmniSharpSection, - m_ConfigGeneration.OmniSharpSettings, - "OmniSharp", - ref m_OmniSharpScrollPosition - ); - FlagButton( ConfigFlag.EditorConfig, "EditorConfig", @@ -408,9 +343,6 @@ ref Vector2 scrollPosition case "Workspace": m_ConfigGeneration.WorkspaceSettings = settings; break; - case "OmniSharp": - m_ConfigGeneration.OmniSharpSettings = settings; - break; case "editorconfig": m_ConfigGeneration.EditorConfigSettings = settings; break; @@ -556,9 +488,6 @@ void RegenerateButton(string guiMessage, string command = "") case "Reset Workspace settings": m_ConfigGeneration.WorkspaceSettings = ""; break; - case "Reset OmniSharp settings": - m_ConfigGeneration.OmniSharpSettings = ""; - break; case "Reset editorconfig settings": m_ConfigGeneration.EditorConfigSettings = ""; break; diff --git a/package.json b/package.json index 4af6b32..33575f9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.tsk.ide.vscode", "displayName": "TSK VSCode Editor", "description": "Unofficial code editor integration for supporting Visual Studio Code as code editor for Unity. Adds support for generating csproj files for intellisense purposes, auto discovery of installations, etc.", - "version": "1.4.6", + "version": "1.4.7", "unity": "2021.3", "dependencies": {}, "author": {