Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 4f7201c

Browse files
cartermpTIHan
authored andcommitted
Revert "Remove dependency on FSharp.LanguageService (dotnet#4108)" (dotnet#4128)
This reverts commit 351d06b.
1 parent c23e753 commit 4f7201c

File tree

6 files changed

+16
-461
lines changed

6 files changed

+16
-461
lines changed

Common/RoslynHelpers.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ open Microsoft.FSharp.Compiler
1414
open Microsoft.FSharp.Compiler.Layout
1515
open Microsoft.FSharp.Compiler.SourceCodeServices
1616
open Microsoft.FSharp.Compiler.Range
17+
open Microsoft.VisualStudio.FSharp.LanguageService
1718

1819
[<RequireQualifiedAccess>]
1920
module internal RoslynHelpers =

Common/Vs.fs

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,84 +3,16 @@
33
namespace Microsoft.VisualStudio.FSharp.Editor
44

55
open System
6-
open System.Runtime.InteropServices
76
open Microsoft.VisualStudio
8-
open Microsoft.VisualStudio.Editor
97
open Microsoft.VisualStudio.Shell.Interop
108
open Microsoft.VisualStudio.TextManager.Interop
119

1210
/// Helper methods for interoperating with COM
13-
module internal Com =
14-
let ThrowOnFailure0(hr) =
15-
ErrorHandler.ThrowOnFailure(hr) |> ignore
16-
17-
let ThrowOnFailure1(hr,res) =
18-
ErrorHandler.ThrowOnFailure(hr) |> ignore;
19-
res
20-
21-
let ThrowOnFailure2(hr,res1,res2) =
22-
ErrorHandler.ThrowOnFailure(hr) |> ignore;
23-
res1,res2
24-
25-
let ThrowOnFailure3(hr,res1,res2,res3) =
26-
ErrorHandler.ThrowOnFailure(hr) |> ignore;
27-
res1,res2,res3
28-
29-
let ThrowOnFailure4(hr,res1,res2,res3,res4) =
30-
ErrorHandler.ThrowOnFailure(hr) |> ignore;
31-
res1,res2,res3,res4
32-
11+
module internal Com =
3312
let Succeeded hr =
3413
// REVIEW: Not the correct check for succeeded
3514
hr = VSConstants.S_OK
3615

37-
module internal VsUserData =
38-
39-
let vsBufferMoniker = Guid("978A8E17-4DF8-432A-9623-D530A26452BC")
40-
41-
// This is the file name of the buffer.
42-
let GetBufferMonker(ud:IVsUserData) : string =
43-
downcast Com.ThrowOnFailure1(ud.GetData(ref vsBufferMoniker))
44-
45-
module internal VsTextLines =
46-
/// Get the length of the given line.
47-
let LengthOfLine (buffer:IVsTextBuffer) (line:int) : int =
48-
Com.ThrowOnFailure1(buffer.GetLengthOfLine(line))
49-
50-
/// Get the text for a particular line.
51-
let LineText (buffer:IVsTextLines) line =
52-
Com.ThrowOnFailure1(buffer.GetLineText(line, 0, line, LengthOfLine buffer line))
53-
54-
/// Get the color state
55-
let TextColorState (buffer:IVsTextLines) : IVsTextColorState= unbox(box(buffer))
56-
57-
/// Get the filename of the given buffer (via IVsUserData). Not all buffers have a file. This will be an exception.
58-
let GetFilename(buffer : IVsTextLines) =
59-
let ud = (box buffer) :?> IVsUserData
60-
VsUserData.GetBufferMonker(ud)
61-
62-
/// Get the string contents of a given buffer (the current snapshot).
63-
let GetFileContents(buffer: IVsTextBuffer, editorAdaptersFactoryService: IVsEditorAdaptersFactoryService) =
64-
let dataBuffer = editorAdaptersFactoryService.GetDataBuffer(buffer)
65-
dataBuffer.CurrentSnapshot.GetText()
66-
67-
module internal VsRunningDocumentTable =
68-
let FindDocumentWithoutLocking(rdt:IVsRunningDocumentTable, url:string) : (IVsHierarchy * IVsTextLines) option =
69-
let (hr:int, hier:IVsHierarchy, _itemid:uint32, unkData:IntPtr, _cookie:uint32) = rdt.FindAndLockDocument(uint32 _VSRDTFLAGS.RDT_NoLock, url)
70-
try
71-
if Com.Succeeded(hr) then
72-
let bufferObject =
73-
if unkData=IntPtr.Zero then null
74-
else Marshal.GetObjectForIUnknown(unkData)
75-
let buffer =
76-
match bufferObject with
77-
| :? IVsTextLines as tl -> tl
78-
| _ -> null
79-
Some(hier, buffer)
80-
else None
81-
finally
82-
if IntPtr.Zero <> unkData then Marshal.Release(unkData)|>ignore
83-
8416
[<AutoOpen>]
8517
module internal ServiceProviderExtensions =
8618
type internal System.IServiceProvider with

FSharp.Editor.fsproj

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<InternalsVisibleTo Include="FSharp.ProjectSystem.FSharp" />
3333
<InternalsVisibleTo Include="VisualFSharp.UnitTests" />
3434
<InternalsVisibleTo Include="VisualFSharp.Salsa" />
35+
</ItemGroup>
36+
<ItemGroup>
3537
<EmbeddedResource Include="FSharp.Editor.resx">
3638
<GenerateSource>true</GenerateSource>
3739
<GeneratedModuleName>Microsoft.VisualStudio.FSharp.Editor.SR</GeneratedModuleName>
@@ -40,20 +42,18 @@
4042
<Compile Include="Common\Pervasive.fs" />
4143
<Compile Include="Common\Extensions.fs" />
4244
<Compile Include="Common\Constants.fs" />
43-
<Compile Include="Common\Error.fs" />
4445
<Compile Include="Common\Logging.fs" />
4546
<Compile Include="Common\RoslynHelpers.fs" />
4647
<Compile Include="Common\CodeAnalysisExtensions.fs" />
4748
<Compile Include="Common\ContentType.fs" />
49+
<Compile Include="Common\Error.fs" />
4850
<Compile Include="Common\Vs.fs" />
4951
<Compile Include="Options\SettingsPersistence.fs" />
5052
<Compile Include="Options\UIHelpers.fs" />
5153
<Compile Include="Options\EditorOptions.fs" />
5254
<Compile Include="LanguageService\Tokenizer.fs" />
5355
<Compile Include="LanguageService\Symbols.fs" />
5456
<Compile Include="LanguageService\FSharpCheckerExtensions.fs" />
55-
<Compile Include="LanguageService\IProjectSite.fs" />
56-
<Compile Include="LanguageService\ProjectSitesAndFiles.fs" />
5757
<Compile Include="LanguageService\LanguageService.fs" />
5858
<Compile Include="LanguageService\AssemblyContentProvider.fs" />
5959
<Compile Include="LanguageService\SymbolHelpers.fs" />
@@ -107,6 +107,11 @@
107107
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
108108
<Name>FSharp.Core</Name>
109109
</ProjectReference>
110+
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.LanguageService\FSharp.LanguageService.fsproj">
111+
<Name>FSharp.LanguageService</Name>
112+
<Project>{ee85aab7-cda0-4c4e-bda0-a64ccc413e3f}</Project>
113+
<Private>True</Private>
114+
</ProjectReference>
110115
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.LanguageService.Base\FSharp.LanguageService.Base.csproj">
111116
<Name>FSharp.LanguageService.Base</Name>
112117
<Project>{1c5c163c-37ea-4a3c-8ccc-0d34b74bf8ef}</Project>
@@ -127,6 +132,8 @@
127132
<Project>{991dcf75-c2eb-42b6-9a0d-aa1d2409d519}</Project>
128133
<Private>True</Private>
129134
</ProjectReference>
135+
</ItemGroup>
136+
<ItemGroup>
130137
<Reference Include="mscorlib" />
131138
<Reference Include="PresentationFramework" />
132139
<Reference Include="System.Windows.Forms" />
@@ -139,6 +146,8 @@
139146
<Reference Include="System" />
140147
<Reference Include="PresentationCore" />
141148
<Reference Include="System.ComponentModel.Composition" />
149+
</ItemGroup>
150+
<ItemGroup>
142151
<Reference Include="EnvDTE">
143152
<HintPath>$(FSharpSourcesRoot)\..\packages\EnvDTE.8.0.1\lib\net10\EnvDTE.dll</HintPath>
144153
<Private>True</Private>
@@ -147,10 +156,6 @@
147156
<HintPath>$(FSharpSourcesRoot)\..\packages\EnvDTE80.8.0.1\lib\net10\EnvDTE80.dll</HintPath>
148157
<Private>True</Private>
149158
</Reference>
150-
<Reference Include="VSLangProj">
151-
<HintPath>$(FSharpSourcesRoot)\..\packages\VSSDK.VSLangProj.7.0.4\lib\net20\VSLangProj.dll</HintPath>
152-
<Private>True</Private>
153-
</Reference>
154159
<Reference Include="Microsoft.VisualStudio.Threading">
155160
<HintPath>$(FSharpSourcesRoot)\..\packages\Microsoft.VisualStudio.Threading.$(MicrosoftVisualStudioThreadingVersion)\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
156161
</Reference>

LanguageService/IProjectSite.fs

Lines changed: 0 additions & 61 deletions
This file was deleted.

LanguageService/LanguageService.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ open Microsoft.FSharp.Compiler.CompileOps
2323
open Microsoft.FSharp.Compiler.SourceCodeServices
2424
open Microsoft.VisualStudio
2525
open Microsoft.VisualStudio.Editor
26-
open Microsoft.VisualStudio.FSharp.Editor.SiteProvider
26+
open Microsoft.VisualStudio.FSharp.LanguageService
27+
open Microsoft.VisualStudio.FSharp.LanguageService.SiteProvider
2728
open Microsoft.VisualStudio.TextManager.Interop
2829
open Microsoft.VisualStudio.LanguageServices
2930
open Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService

0 commit comments

Comments
 (0)