Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec13ce3

Browse files
committed
Added ProvideBraceCompletionAttribute
1 parent5d22bec commitec13ce3

File tree

7 files changed

+42
-17
lines changed

7 files changed

+42
-17
lines changed

‎build/targets/PackageVersions.props‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@
4545
<MicrosoftVisualStudioShellInterop100PackageVersion>10.0.30319</MicrosoftVisualStudioShellInterop100PackageVersion>
4646
<MicrosoftVisualStudioShellInterop110PackageVersion>11.0.61030</MicrosoftVisualStudioShellInterop110PackageVersion>
4747
<MicrosoftVisualStudioShellInterop120PackageVersion>12.0.30110</MicrosoftVisualStudioShellInterop120PackageVersion>
48-
<MicrosoftVisualStudioTextManagerInteropPackageVersion>7.10.6070</MicrosoftVisualStudioTextManagerInteropPackageVersion>
48+
<MicrosoftVisualStudioTextManagerInteropPackageVersion>7.10.6071</MicrosoftVisualStudioTextManagerInteropPackageVersion>
4949
<MicrosoftVisualStudioTextManagerInterop80PackageVersion>8.0.50727</MicrosoftVisualStudioTextManagerInterop80PackageVersion>
5050
<MicrosoftVisualStudioTextManagerInterop100PackageVersion>10.0.30319</MicrosoftVisualStudioTextManagerInterop100PackageVersion>
51+
<MicrosoftVisualStudioTextManagerInterop120PackageVersion>12.0.30112</MicrosoftVisualStudioTextManagerInterop120PackageVersion>
5152
<MicrosoftVisualStudioTextUIPackageVersion>15.6.27740</MicrosoftVisualStudioTextUIPackageVersion>
5253
<MicrosoftVisualStudioTextUIWpfPackageVersion>15.6.27740</MicrosoftVisualStudioTextUIWpfPackageVersion>
5354
<MicrosoftVisualStudioWCFReferenceInteropPackageVersion>9.0.30729</MicrosoftVisualStudioWCFReferenceInteropPackageVersion>

‎vsintegration/src/FSharp.Editor/AutomaticCompletion/BraceCompletionSessionProvider.fs‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ open Microsoft.CodeAnalysis.Classification
2222
[<AutoOpen>]
2323
moduleBraceCompletionSessionProviderHelpers=
2424

25-
lettryGetLanguageService<'Twhen'T:>ILanguageServiceand'T:null>(document:Document)=
26-
match document.Projectwith
27-
|null-> None
28-
| project->
29-
match project.LanguageServiceswith
30-
|null-> None
31-
| languageServices->
32-
languageServices.GetService<'T>()
33-
|> Some
34-
3525
lettryGetCaretPoint(buffer:ITextBuffer)(session:IBraceCompletionSession)=
3626
letpoint= session.TextView.Caret.Position.Point.GetPoint(buffer, PositionAffinity.Predecessor)
3727
if point.HasValuethen Some point.Value
@@ -94,6 +84,10 @@ type BraceCompletionSession
9484
undoHistory.CreateTransaction(BraceCompletion)
9585

9686
memberthis.Start(cancellationToken:CancellationToken)=
87+
// Sanity check.
88+
if closingPoint=nullthen this.EndSession()
89+
else
90+
9791
// this is where the caret should go after the change
9892
letpos= textView.Caret.Position.BufferPosition
9993
letbeforeTrackingPoint= pos.Snapshot.CreateTrackingPoint(pos.Position, PointTrackingMode.Negative)
@@ -534,7 +528,7 @@ type BraceCompletionSessionProvider
534528
session<-
535529
maybe{
536530
let!document= openingPoint.Snapshot.GetOpenDocumentInCurrentContextWithChanges()|> Option.ofObj
537-
let!sessionFactory=tryGetLanguageService<IEditorBraceCompletionSessionFactory> document
531+
let!sessionFactory=document.TryGetLanguageService<IEditorBraceCompletionSessionFactory>()
538532
let!session= sessionFactory.TryCreateSession(document, openingPoint.Position, openingBrace, CancellationToken.None)|> Option.ofObj
539533

540534
letundoHistory= undoManager.GetTextBufferUndoManager(textView.TextBuffer).TextBufferUndoHistory
@@ -550,6 +544,4 @@ type BraceCompletionSessionProvider
550544
}
551545
|> Option.toObj
552546

553-
match sessionwith
554-
|null->false
555-
|_->true
547+
session<>null

‎vsintegration/src/FSharp.Editor/Common/Extensions.fs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module internal Microsoft.VisualStudio.FSharp.Editor.Extensions
66
openSystem
77
openSystem.IO
88
openMicrosoft.CodeAnalysis
9+
openMicrosoft.CodeAnalysis.Host
910
openMicrosoft.FSharp.Compiler.Ast
1011
openMicrosoft.FSharp.Compiler.SourceCodeServices
1112

@@ -28,6 +29,17 @@ type ProjectId with
2829
memberthis.ToFSharpProjectIdString()=
2930
this.Id.ToString("D").ToLowerInvariant()
3031

32+
typeDocumentwith
33+
memberthis.TryGetLanguageService<'Twhen'T:>ILanguageService>()=
34+
match this.Projectwith
35+
|null-> None
36+
| project->
37+
match project.LanguageServiceswith
38+
|null-> None
39+
| languageServices->
40+
languageServices.GetService<'T>()
41+
|> Some
42+
3143
typeFSharpNavigationDeclarationItemwith
3244
memberx.RoslynGlyph:Glyph=
3345
match x.Glyphwith

‎vsintegration/src/FSharp.Editor/Common/Pervasive.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ open System.IO
66
openSystem.Threading.Tasks
77
openSystem.Diagnostics
88

9+
typeIOleServiceProvider= Microsoft.VisualStudio.OLE.Interop.IServiceProvider
910

1011
/// Checks if the filePath ends with ".fsi"
1112
letisSignatureFile(filePath:string)=

‎vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<CompileInclude="Options\SettingsPersistence.fs" />
4141
<CompileInclude="Options\UIHelpers.fs" />
4242
<CompileInclude="Options\EditorOptions.fs" />
43+
<CompileInclude="LanguageService\ProvideBraceCompletionAttribute.fs" />
4344
<CompileInclude="LanguageService\FSharpEditorFactory.fs" />
4445
<CompileInclude="LanguageService\TextViewCreationListener.fs" />
4546
<CompileInclude="LanguageService\Tokenizer.fs" />
@@ -150,7 +151,7 @@
150151
<PackageReferenceInclude="Microsoft.VisualStudio.Text.UI"Version="$(MicrosoftVisualStudioTextUIPackageVersion)" />
151152
<PackageReferenceInclude="Microsoft.VisualStudio.Text.UI.Wpf"Version="$(MicrosoftVisualStudioTextUIWpfPackageVersion)" />
152153
<PackageReferenceInclude="Microsoft.VisualStudio.TextManager.Interop"Version="$(MicrosoftVisualStudioTextManagerInteropPackageVersion)" />
153-
<PackageReferenceInclude="Microsoft.VisualStudio.TextManager.Interop.8.0"Version="$(MicrosoftVisualStudioTextManagerInterop80PackageVersion)" />
154+
<PackageReferenceInclude="Microsoft.VisualStudio.TextManager.Interop.12.0"Version="$(MicrosoftVisualStudioTextManagerInterop120PackageVersion)" />
154155
<PackageReferenceInclude="Microsoft.VSSDK.BuildTools"Version="$(MicrosoftVSSDKBuildToolsPackageVersion)"ExcludeAssets="all" />
155156
<PackageReferenceInclude="Newtonsoft.Json"Version="$(NewtonsoftJsonPackageVersion)" />
156157
<PackageReferenceInclude="System.Collections.Immutable"Version="$(SystemCollectionsImmutablePackageVersion)" />

‎vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ type internal FSharpCheckerWorkspaceServiceFactory
344344
[<ProvideLanguageExtension(typeof<FSharpLanguageService>,".fsscript")>]
345345
[<ProvideLanguageExtension(typeof<FSharpLanguageService>,".ml")>]
346346
[<ProvideLanguageExtension(typeof<FSharpLanguageService>,".mli")>]
347+
[<ProvideBraceCompletion(FSharpConstants.FSharpLanguageName)>]
347348
[<ProvideLanguageService(languageService= typeof<FSharpLanguageService>,
348349
strLanguageName= FSharpConstants.FSharpLanguageName,
349350
languageResourceID=100,
@@ -383,6 +384,7 @@ type internal FSharpPackage() as this =
383384
Microsoft.VisualStudio.FSharp.Interactive.Hooks.fsiConsoleWindowPackageInitalizeSited(this:> Package) commandService
384385
// FSI-LINKAGE-POINT: private method GetDialogPage forces fsi options to be loaded
385386
let_fsiPropertyPage= this.GetDialogPage(typeof<Microsoft.VisualStudio.FSharp.Interactive.FsiPropertyPage>)
387+
386388
()
387389

388390
overridethis.RoslynLanguageName= FSharpConstants.FSharpLanguageName
@@ -434,7 +436,6 @@ type internal FSharpLanguageService(package : FSharpPackage) =
434436
overridethis.Initialize()=
435437
base.Initialize()
436438

437-
438439
letworkspaceChanged(args:WorkspaceChangeEventArgs)=
439440
match args.Kindwith
440441
| WorkspaceChangeKind.ProjectAdded-> this.OnProjectAdded(args.ProjectId)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespaceMicrosoft.VisualStudio.FSharp.Editor
4+
5+
openSystem
6+
openMicrosoft.VisualStudio.Shell
7+
8+
[<Sealed>]
9+
[<AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
10+
typeinternalProvideBraceCompletionAttribute(languageName: string)=
11+
inherit RegistrationAttribute()
12+
13+
override__.Register(context)=
14+
use key= context.CreateKey(@"Languages\Language Services\"+ languageName)
15+
key.SetValue("ShowBraceCompletion",1)
16+
17+
override__.Unregister(_)=()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp