-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Onboard VB intellisense page to Unified Settings #72471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0fd347e
Rename registration.json and add ProvideSettingsManifest
Cosifne 9f9c6da
Add name
Cosifne 566ca4e
Fix name
Cosifne 8f5ce76
Clean
Cosifne e94de2f
Add an entry in pkgdef
Cosifne 2e700ac
Add comment
Cosifne 219a102
Change csproj
Cosifne e45f506
Fix source build
Cosifne 990fa52
Add entries for VB settings
Cosifne e654161
Change it to VB content
Cosifne 0f4402e
Rename to basic
Cosifne c3ef061
Put resources in package resources
Cosifne 189299e
Clean up after rebasing
Cosifne 6b32646
Add comment
Cosifne a339369
Change the package entry
Cosifne 88170e0
Merge part of the resources
Cosifne 46d5748
Merge remote-tracking branch 'upstream/main' into dev/shech/UnifiedSe…
Cosifne f9d8346
Add test
Cosifne cbc855e
Override some behaviors
Cosifne 9165bbb
Add other overrides
Cosifne 2e2ad38
Add comments
Cosifne dcea7cf
Remove a bad conflict after merging from main
Cosifne a622b83
Using xxHash to guard the value
Cosifne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
src/VisualStudio/Core/Test/UnifiedSettings/VisualBasicUnifiedSettingsTests.vb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| ' Licensed to the .NET Foundation under one or more agreements. | ||
| ' The .NET Foundation licenses this file to you under the MIT license. | ||
| ' See the LICENSE file in the project root for more information. | ||
|
|
||
| Imports System.Collections.Immutable | ||
| Imports System.IO | ||
| Imports System.Reflection | ||
| Imports Microsoft.CodeAnalysis | ||
| Imports Microsoft.CodeAnalysis.Completion | ||
| Imports Microsoft.CodeAnalysis.Options | ||
| Imports Microsoft.VisualStudio.LanguageServices | ||
| Imports Microsoft.VisualStudio.LanguageServices.UnitTests.UnifiedSettings | ||
| Imports Newtonsoft.Json.Linq | ||
|
|
||
| Namespace Roslyn.VisualStudio.VisualBasic.UnitTests.UnifiedSettings | ||
| Public Class VisualBasicUnifiedSettingsTests | ||
| Inherits UnifiedSettingsTests | ||
|
|
||
| Friend Overrides ReadOnly Property OnboardedOptions As ImmutableArray(Of IOption2) | ||
| Get | ||
| Return ImmutableArray.Create(Of IOption2)( | ||
| CompletionOptionsStorage.TriggerOnTypingLetters, | ||
| CompletionOptionsStorage.TriggerOnDeletion, | ||
| CompletionViewOptionsStorage.HighlightMatchingPortionsOfCompletionListItems, | ||
| CompletionViewOptionsStorage.ShowCompletionItemFilters, | ||
| CompletionOptionsStorage.SnippetsBehavior, | ||
| CompletionOptionsStorage.EnterKeyBehavior, | ||
| CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces, | ||
| CompletionViewOptionsStorage.EnableArgumentCompletionSnippets | ||
| ) | ||
| End Get | ||
| End Property | ||
|
|
||
| Friend Overrides Function GetEnumOptionValues([option] As IOption2) As Object() | ||
| Dim allValues = [Enum].GetValues([option].Type).Cast(Of Object) | ||
| If [option].Equals(CompletionOptionsStorage.SnippetsBehavior) Then | ||
| 'SnippetsRule.Default is used as a stub value, overridden per language at runtime. | ||
| ' It is not shown in the option page | ||
| Return allValues.Where(Function(value) Not value.Equals(SnippetsRule.Default)).ToArray() | ||
| ElseIf [option].Equals(CompletionOptionsStorage.EnterKeyBehavior) Then | ||
| ' EnterKeyRule.Default is used as a stub value, overridden per language at runtime. | ||
| ' It Is Not shown in the option page | ||
| Return allValues.Where(Function(value) Not value.Equals(EnterKeyRule.Default)).ToArray() | ||
| End If | ||
|
|
||
| Return MyBase.GetEnumOptionValues([option]) | ||
| End Function | ||
|
|
||
| Friend Overrides Function GetOptionsDefaultValue([option] As IOption2) As Object | ||
| ' The default values of some options are set at runtime. option.defaultValue is just a dummy value in this case. | ||
| ' However, in unified settings we always set the correct value in registration.json. | ||
| If [option].Equals(CompletionOptionsStorage.SnippetsBehavior) Then | ||
| ' CompletionOptionsStorage.SnippetsBehavior's default value is SnippetsRule.Default. | ||
| ' It's overridden differently per-language at runtime. | ||
| Return SnippetsRule.IncludeAfterTypingIdentifierQuestionTab | ||
| ElseIf [option].Equals(CompletionOptionsStorage.EnterKeyBehavior) Then | ||
| ' CompletionOptionsStorage.EnterKeyBehavior's default value is EnterKeyBehavior.Default. | ||
| ' It's overridden differently per-language at runtime. | ||
| Return EnterKeyRule.Always | ||
| ElseIf [option].Equals(CompletionOptionsStorage.TriggerOnDeletion) Then | ||
| ' CompletionOptionsStorage.TriggerOnDeletion's default value is null. | ||
| ' It's enabled by default for Visual Basic | ||
| Return True | ||
| ElseIf [option].Equals(CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces) Then | ||
| ' CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces's default value is null | ||
| ' It's enabled by default for Visual Basic | ||
| Return True | ||
| ElseIf [option].Equals(CompletionViewOptionsStorage.EnableArgumentCompletionSnippets) Then | ||
| ' CompletionViewOptionsStorage.EnableArgumentCompletionSnippets' default value is null | ||
| ' It's disabled by default for Visual Basic | ||
| Return False | ||
| End If | ||
|
|
||
| Return MyBase.GetOptionsDefaultValue([option]) | ||
| End Function | ||
|
|
||
| <Fact> | ||
| Public Async Function IntelliSensePageTests() As Task | ||
| Using registrationFileStream = GetType(VisualBasicUnifiedSettingsTests).GetTypeInfo().Assembly.GetManifestResourceStream("visualBasicSettings.registration.json") | ||
| Using pkgDefFileStream = GetType(VisualBasicUnifiedSettingsTests).GetTypeInfo().Assembly.GetManifestResourceStream("PackageRegistration.pkgdef") | ||
| Using pkgDefFileReader = New StreamReader(pkgDefFileStream) | ||
| Using reader = New StreamReader(registrationFileStream) | ||
| Dim registrationFile = Await reader.ReadToEndAsync().ConfigureAwait(False) | ||
| Dim pkgDefFile = Await pkgDefFileReader.ReadToEndAsync().ConfigureAwait(False) | ||
| Dim registrationJsonObject = JObject.Parse(registrationFile, New JsonLoadSettings()) | ||
| Dim categoriesTitle = registrationJsonObject.SelectToken("$.categories['textEditor.basic'].title") | ||
| Assert.Equal("Visual Basic", categoriesTitle) | ||
| Dim optionPageId = registrationJsonObject.SelectToken("$.categories['textEditor.basic.intellisense'].legacyOptionPageId") | ||
| Assert.Equal(Guids.VisualBasicOptionPageIntelliSenseIdString, optionPageId.ToString()) | ||
| TestUnifiedSettingsCategory(registrationJsonObject, categoryBasePath:="textEditor.basic.intellisense", languageName:=LanguageNames.VisualBasic, pkgDefFile) | ||
| End Using | ||
| End Using | ||
| End Using | ||
| End Using | ||
| End Function | ||
| End Class | ||
| End Namespace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so in the previous code
snippetValueisEnterKeyRulebut compared to aSnippetsRule.DefaultHere change it to the correct type
EnterKeyRule(Complier think it's OK, emm? )
But since they all default to value
0, so no functional change in fact.