Skip to content

Commit

Permalink
Fix CodeStylePage EditorConfigOptionsGenerator service (#69425)
Browse files Browse the repository at this point in the history
* Fix codestylepage service

* remove unnecessary usings
  • Loading branch information
Becca McHenry authored Aug 10, 2023
1 parent 56d4640 commit 26d92fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
10 changes: 3 additions & 7 deletions src/VisualStudio/CSharp/Impl/Options/Formatting/CodeStylePage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
#nullable disable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.EditorConfig;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.VisualStudio.LanguageServices.Implementation.Options;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Extensions;

namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
{
Expand All @@ -23,7 +18,8 @@ internal class CodeStylePage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
var editorService = (EditorConfigOptionsGenerator)serviceProvider.GetService(typeof(EditorConfigOptionsGenerator));
var editorService = serviceProvider.GetMefService<EditorConfigOptionsGenerator>();

return new GridOptionPreviewControl(
serviceProvider,
optionStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@
' 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.Runtime.InteropServices
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.Options.EditorConfig
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.CodeStyle
Imports Microsoft.VisualStudio.ComponentModelHost
Imports Microsoft.VisualStudio.LanguageServices.Implementation.Options
Imports Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Extensions

Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options.Formatting
<Guid(Guids.VisualBasicOptionPageCodeStyleIdString)>
Friend Class CodeStylePage
Inherits AbstractOptionPage

Protected Overrides Function CreateOptionPage(serviceProvider As IServiceProvider, optionStore As OptionStore) As AbstractOptionPageControl
Dim editorService = DirectCast(serviceProvider.GetService(GetType(EditorConfigOptionsGenerator)), EditorConfigOptionsGenerator)
Dim editorService = serviceProvider.GetMefService(Of EditorConfigOptionsGenerator)()
Return New GridOptionPreviewControl(serviceProvider,
optionStore,
Function(o, s) New StyleViewModel(o, s),
Expand Down

0 comments on commit 26d92fc

Please sign in to comment.