diff --git a/Test/EditorConfigTest/SchemaCatalogTest.cs b/Test/EditorConfigTest/SchemaCatalogTest.cs index cd631e9ad3f..19c398e3b07 100644 --- a/Test/EditorConfigTest/SchemaCatalogTest.cs +++ b/Test/EditorConfigTest/SchemaCatalogTest.cs @@ -131,5 +131,148 @@ public void Severities_ContainsExpectedValues() Assert.IsTrue(exists, $"Severity '{severityName}' should exist"); } } + + [TestMethod] + public void TryGetKeyword_SpellingLanguages_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("spelling_languages", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("spelling_languages", keyword.Name); + Assert.AreEqual(Category.VisualStudio, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_SpellingCheckableTypes_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("spelling_checkable_types", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("spelling_checkable_types", keyword.Name); + Assert.AreEqual(Category.VisualStudio, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupAddMissing_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_add_missing", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_add_missing", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupRemoveUnused_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_remove_unused", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_remove_unused", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupAddMissingErrorTagType_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_add_missing_error_tag_type", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_add_missing_error_tag_type", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupEnabled_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_enabled", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_enabled", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupExcludedFiles_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_excluded_files", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_excluded_files", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupRequiredFiles_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_required_files", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_required_files", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupHeaderRemappings_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_header_remappings", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_header_remappings", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_CppIncludeCleanupAlternateFiles_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("cpp_include_cleanup_alternate_files", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("cpp_include_cleanup_alternate_files", keyword.Name); + Assert.AreEqual(Category.CPP, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_SpellingExclusionPath_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("spelling_exclusion_path", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("spelling_exclusion_path", keyword.Name); + Assert.AreEqual(Category.VisualStudio, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_SpellingUseDefaultExclusionDictionary_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("spelling_use_default_exclusion_dictionary", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("spelling_use_default_exclusion_dictionary", keyword.Name); + Assert.AreEqual(Category.VisualStudio, keyword.Category); + } + + [TestMethod] + public void TryGetKeyword_SpellingErrorSeverity_ReturnsTrue() + { + bool result = SchemaCatalog.TryGetKeyword("spelling_error_severity", out Keyword keyword); + + Assert.IsTrue(result); + Assert.IsNotNull(keyword); + Assert.AreEqual("spelling_error_severity", keyword.Name); + Assert.AreEqual(Category.VisualStudio, keyword.Category); + } } } diff --git a/src/Completion/CompletionSource.cs b/src/Completion/CompletionSource.cs index 173603e4d0c..0475b43aa1b 100644 --- a/src/Completion/CompletionSource.cs +++ b/src/Completion/CompletionSource.cs @@ -350,6 +350,7 @@ private static void CreateCompletionSet(string moniker, IList com new(KnownMonikers.CSFileNode, "C# analysis rules (Alt + C)", "c", Category.CSharp.ToString()), new(KnownMonikers.DotNET, ".NET analysis rules (Alt + D)", "d", Category.DotNet.ToString()), new(KnownMonikers.VBFileNode, "VB.NET analysis rules (Alt + V)", "v", Category.VisualBasic.ToString()), + new(KnownMonikers.VisualStudio, "Visual Studio rules (Alt + U)", "u", Category.VisualStudio.ToString()), }; // Add dynamic filters for custom schemas diff --git a/src/Schema/Category.cs b/src/Schema/Category.cs index c238451c485..a4f2d153fa8 100644 --- a/src/Schema/Category.cs +++ b/src/Schema/Category.cs @@ -8,6 +8,7 @@ public enum Category DotNet, VisualBasic, CPP, + VisualStudio, Custom, } } diff --git a/src/Schema/EditorConfig.json b/src/Schema/EditorConfig.json index 1c16c7c9b03..614d21bfbcd 100644 --- a/src/Schema/EditorConfig.json +++ b/src/Schema/EditorConfig.json @@ -1764,6 +1764,105 @@ "values": [ "one_liners", "all_one_line_scopes", "never" ], "defaultValue": [ "one_liners" ], "documentationLink": "https://learn.microsoft.com/en-us/visualstudio/ide/cpp-editorconfig-properties" + }, + { + "name": "cpp_include_cleanup_enabled", + "description": "Controls whether include cleanup is enabled. Set to true to enable automatic detection of unused and missing includes.", + "values": [ true, false ], + "defaultValue": [ true ], + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_add_missing", + "description": "Add missing direct includes. Determines the suggestion level for adding missing direct includes (content is used but only available transitively).", + "values": [ "refactoring_only", "suggestion", "warning", "error" ], + "defaultValue": [ "suggestion" ], + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_remove_unused", + "description": "Remove unused includes. Determines the suggestion level for removing unused includes (include is not used in the file).", + "values": [ "refactoring_only", "suggestion", "warning", "error" ], + "defaultValue": [ "suggestion" ], + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_add_missing_error_tag_type", + "description": "Error tag type for missing direct includes. Sets the diagnostic level for VCIC001 messages about missing direct includes.", + "values": [ "refactoring_only", "suggestion", "warning", "error" ], + "defaultValue": [ "suggestion" ], + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_excluded_files", + "description": "Comma-separated list of header files to exclude from being marked as unused (e.g., 'io.h, windows.h'). Wildcards are not supported.", + "values": [ "" ], + "defaultValue": [ "" ], + "multiple": true, + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_required_files", + "description": "Comma-separated list of header files which are always considered required, preventing them from being flagged as unused (e.g., 'mycompany/musthave.h').", + "values": [ "" ], + "defaultValue": [ "" ], + "multiple": true, + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_header_remappings", + "description": "Defines header file remappings for suggesting alternative includes (e.g., 'corecrt_io.h=io.h').", + "values": [ "=" ], + "defaultValue": [ "" ], + "multiple": true, + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + { + "name": "cpp_include_cleanup_alternate_files", + "description": "Specifies alternative header files that should be suggested instead of the transitive include (e.g., '; ').", + "values": [ "" ], + "defaultValue": [ "" ], + "multiple": true, + "documentationLink": "https://learn.microsoft.com/en-us/cpp/ide/include-cleanup-config?view=msvc-170" + }, + + // Visual Studio specific properties + { + "name": "spelling_languages", + "description": "Specifies which language dictionaries to use for spell checking. Comma-separated culture codes (e.g., 'en-us,fr-fr,de-de'). Requires Windows language packs.", + "values": [ "en-us", "fr-fr", "de-de", "es-es", "it-it", "pt-br", "ja-jp", "zh-cn", "zh-tw", "ko-kr" ], + "defaultValue": [ "en-us" ], + "multiple": true, + "documentationLink": "https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022" + }, + { + "name": "spelling_checkable_types", + "description": "Specifies which code elements to include in spell checking. Comma-separated list of types: identifiers, comments, strings, plainText.", + "values": [ "identifiers", "comments", "strings", "plainText" ], + "defaultValue": [ "comments", "strings" ], + "multiple": true, + "documentationLink": "https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022" + }, + { + "name": "spelling_exclusion_path", + "description": "Specifies a path to a custom dictionary file where ignored words are stored. When using 'Ignore', Visual Studio adds words to this file.", + "values": [ "" ], + "defaultValue": [ "" ], + "documentationLink": "https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022" + }, + { + "name": "spelling_use_default_exclusion_dictionary", + "description": "Determines whether Visual Studio uses its built-in exclusion dictionary of common programming terms and identifiers. Set to false to use only custom exclusion files.", + "values": [ true, false ], + "defaultValue": [ true ], + "documentationLink": "https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022" + }, + { + "name": "spelling_error_severity", + "description": "Sets the severity level for detected spelling errors in the editor.", + "values": [ "none", "information", "warning", "error" ], + "defaultValue": [ "information" ], + "documentationLink": "https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022" } ] } diff --git a/src/Schema/Keyword.cs b/src/Schema/Keyword.cs index 1337c599293..8775e8b33c9 100644 --- a/src/Schema/Keyword.cs +++ b/src/Schema/Keyword.cs @@ -76,6 +76,8 @@ public Category Category return Category.VisualBasic; else if (Name.StartsWith("cpp_", StringComparison.OrdinalIgnoreCase)) return Category.CPP; + else if (Name.StartsWith("spelling_", StringComparison.OrdinalIgnoreCase)) + return Category.VisualStudio; else return Category.Standard; } @@ -101,6 +103,7 @@ public ImageMoniker Moniker Category.DotNet => KnownMonikers.DotNET, Category.VisualBasic => KnownMonikers.VBFileNode, Category.CPP => KnownMonikers.CPPFileNode, + Category.VisualStudio => KnownMonikers.VisualStudio, _ => KnownMonikers.Property, }; }