Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions Test/EditorConfigTest/SchemaCatalogTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
1 change: 1 addition & 0 deletions src/Completion/CompletionSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ private static void CreateCompletionSet(string moniker, IList<CompletionSet> 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
Expand Down
1 change: 1 addition & 0 deletions src/Schema/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum Category
DotNet,
VisualBasic,
CPP,
VisualStudio,
Custom,
}
}
99 changes: 99 additions & 0 deletions src/Schema/EditorConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [ "<header_file>" ],
"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": [ "<header_file>" ],
"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": [ "<source_header>=<target_header>" ],
"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., '<corecrt_io.h>; <io.h>').",
"values": [ "<header_file>" ],
"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": [ "<path_to_file>" ],
"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"
}
]
}
3 changes: 3 additions & 0 deletions src/Schema/Keyword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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,
};
}
Expand Down