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

Commitb02cc36

Browse files
dungpaKevinRansom
authored andcommitted
Give F# Interactive buffer its own content type (dotnet#2192)
* Give F# Interactive buffer its own content type* Remove dummy classifier
1 parentf8103bb commitb02cc36

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

‎vsintegration/src/FSharp.VS.FSI/FSHarp.VS.FSI.fsproj‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,26 @@
2727
<GeneratePkgDefFile>true</GeneratePkgDefFile>
2828
<IncludePkgdefInVSIXContainer>true</IncludePkgdefInVSIXContainer>
2929
</PropertyGroup>
30+
<ImportProject="$(FSharpSourcesRoot)\FSharpSource.targets" />
31+
<ImportProject="$(FSharpSourcesRoot)\..\vsintegration\vsintegration.targets" />
32+
<ImportProject="$(VsSDKInstall)\Microsoft.VsSDK.targets" />
33+
<TargetName="GatherBinariesToBeSigned"AfterTargets="Localize"Condition="'$(UseGatherBinaries)' == 'true'">
34+
<ItemGroup>
35+
<BinariesToBeSignedInclude="$(OutDir)$(AssemblyName).dll" />
36+
<BinariesToBeSignedInclude="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
37+
<FilesToSignInclude="@(BinariesToBeSigned)">
38+
<Authenticode>Microsoft</Authenticode>
39+
<StrongName>StrongName</StrongName>
40+
</FilesToSign>
41+
</ItemGroup>
42+
</Target>
3043
<ItemGroup>
3144
<FilesToLocalizeInclude="$(OutDir)$(AssemblyName).dll">
3245
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
3346
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
3447
<HasLceComments>false</HasLceComments>
3548
<InProject>false</InProject>
3649
</FilesToLocalize>
37-
</ItemGroup>
38-
<ItemGroup>
3950
<FsSrGenInclude="VFSIstrings.txt" />
4051
<CompileInclude="AssemblyInfo.fs" />
4152
<CompileInclude="srProperties.fs" />
@@ -66,6 +77,7 @@
6677
<ReferenceInclude="Microsoft.VisualStudio.OLE.Interop.dll" />
6778
<ReferenceInclude="EnvDTE.dll" />
6879
<ReferenceInclude="EnvDTE80.dll" />
80+
<ReferenceInclude="System.ComponentModel.Composition" />
6981
<ReferenceInclude="VSLangProj" />
7082
<ReferenceInclude="VSLangProj80" />
7183
<ReferenceInclude="Microsoft.VisualStudio.OLE.Interop.dll" />
@@ -146,17 +158,4 @@
146158
<Project>{d5870cf0-ed51-4cbc-b3d7-6f56da84ac06}</Project>
147159
</ProjectReference>
148160
</ItemGroup>
149-
<ImportProject="$(FSharpSourcesRoot)\FSharpSource.targets" />
150-
<ImportProject="$(FSharpSourcesRoot)\..\vsintegration\vsintegration.targets" />
151-
<ImportProject="$(VsSDKInstall)\Microsoft.VsSDK.targets" />
152-
<TargetName="GatherBinariesToBeSigned"AfterTargets="Localize"Condition="'$(UseGatherBinaries)' == 'true'">
153-
<ItemGroup>
154-
<BinariesToBeSignedInclude="$(OutDir)$(AssemblyName).dll" />
155-
<BinariesToBeSignedInclude="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
156-
<FilesToSignInclude="@(BinariesToBeSigned)">
157-
<Authenticode>Microsoft</Authenticode>
158-
<StrongName>StrongName</StrongName>
159-
</FilesToSign>
160-
</ItemGroup>
161-
</Target>
162161
</Project>

‎vsintegration/src/FSharp.VS.FSI/fsiBasis.fs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ module internal Guids =
7575

7676
letguidFsharpLanguageService= Guid("BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B")// The F# source file lang service
7777

78+
[<Literal>]
79+
letfsiContentTypeName="FSharpInteractive"
80+
7881
moduleinternalUtil=
7982
/// Utility function to create an instance of a class from the local registry. [From Iron Python].
8083
letCreateObject(globalProvider:System.IServiceProvider)(classType:Type,interfaceType:Type)=

‎vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ open Microsoft.VisualStudio.Shell
1616
openMicrosoft.VisualStudio.Shell.Interop
1717
openMicrosoft.VisualStudio.Package
1818
openMicrosoft.VisualStudio.TextManager.Interop
19+
openSystem.ComponentModel.Composition
20+
openMicrosoft.VisualStudio.Utilities
1921

2022
openUtil
2123
openSystem.ComponentModel
@@ -24,6 +26,11 @@ open Microsoft.VisualStudio.FSharp.Interactive.Session
2426
moduleSP= Microsoft.VisualStudio.FSharp.Interactive.Session.SessionsProperties
2527

2628

29+
moduleinternalContentType=
30+
[<Export>]
31+
[<Name(Guids.fsiContentTypeName)>]
32+
[<BaseDefinition("code")>]
33+
letFSharpContentTypeDefinition= ContentTypeDefinition()
2734

2835
// FsiPropertyPage
2936
[<ComVisible(true)>]

‎vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ open EnvDTE
1919
openMicrosoft.VisualStudio.ComponentModelHost
2020
openMicrosoft.VisualStudio.Editor
2121
openMicrosoft.VisualStudio.Text.Editor
22-
22+
openMicrosoft.VisualStudio.Text
23+
openMicrosoft.VisualStudio.Utilities
2324

2425
typeVSStd2KCmdID= VSConstants.VSStd2KCmdID// nested type
2526
typeVSStd97CmdID= VSConstants.VSStd97CmdID// nested type
@@ -86,14 +87,14 @@ type internal FsiToolWindow() as this =
8687

8788
letproviderGlobal= Package.GetGlobalService(typeof<IOleServiceProvider>):?> IOleServiceProvider
8889
letprovider=new ServiceProvider(providerGlobal):> System.IServiceProvider
89-
lettextViewAdapter=
90+
lettextViewAdapter,contentTypeRegistry=
9091
// end of 623708 workaround.
9192
letcomponentModel= provider.GetService(typeof<SComponentModel>):?> IComponentModel
92-
componentModel.GetService<IVsEditorAdaptersFactoryService>()
93+
componentModel.GetService<IVsEditorAdaptersFactoryService>(), componentModel.GetService<IContentTypeRegistryService>()
9394

9495
// REVIEW: trap provider nulls?
9596
letproviderNative= provider.GetService(typeof<IOleServiceProvider>):?> IOleServiceProvider
96-
lettextLines= Util.CreateObjectT<VsTextBufferClass,IVsTextLines> provider
97+
lettextLines= Util.CreateObjectT<VsTextBufferClass,IVsTextLines> provider
9798
do setSiteForObjectWithSite textLines providerNative
9899
do textLines.InitializeContent("",0)|> throwOnFailure0
99100
lettextView= Util.CreateObjectT<VsTextViewClass,IVsTextView> provider
@@ -123,7 +124,7 @@ type internal FsiToolWindow() as this =
123124
do codeWinMan.OnNewView(textView)|> throwOnFailure0
124125

125126
// Create the stream on top of the text buffer.
126-
lettextStream=new TextBufferStream(textViewAdapter.GetDataBuffer(textLines))
127+
lettextStream=new TextBufferStream(textViewAdapter.GetDataBuffer(textLines), contentTypeRegistry)
127128
letsynchronizationContext= System.Threading.SynchronizationContext.Current
128129
letwin32win={new System.Windows.Forms.IWin32Windowwithmemberthis.Handle= textView.GetWindowHandle()}
129130
let mutabletextView= textView

‎vsintegration/src/FSharp.VS.FSI/fsiTextBufferStream.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ open Util
1919
openMicrosoft.VisualStudio.Editor
2020
openMicrosoft.VisualStudio.Text
2121
openMicrosoft.VisualStudio.Text.Editor
22+
openMicrosoft.VisualStudio.Utilities
2223

2324
// This type wraps the IVsTextLines which contains the FSI session (output and input).
2425
// It provides the API for writing directly to the read-only part of the buffer.
2526
// It extends the read-only marker on the buffer (making the written text read-only).
2627
//
27-
typeinternalTextBufferStream(textLines:ITextBuffer)=
28+
typeinternalTextBufferStream(textLines:ITextBuffer,contentTypeRegistry: IContentTypeRegistryService)=
2829
doifnull= textLinesthen raise(new ArgumentNullException("textLines"))
29-
30+
do textLines.ChangeContentType(contentTypeRegistry.GetContentType Guids.fsiContentTypeName, Guid Guids.guidFsiLanguageService)
3031
let mutablereadonlyRegion=null: IReadOnlyRegion
3132

3233
letextendReadOnlyRegion position=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp