Skip to content

Commit b900968

Browse files
cartermpKevinRansom
authored andcommitted
Remove IVTs to legacy language service (#7001)
* Remove IVTs to legacy language service * Use public API and remove seemingly useless test
1 parent cb880d5 commit b900968

4 files changed

Lines changed: 7 additions & 29 deletions

File tree

src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040

4141
<ItemGroup>
4242
<InternalsVisibleTo Include="fsc" />
43-
<InternalsVisibleTo Include="FSharp.LanguageService" />
44-
<InternalsVisibleTo Include="FSharp.LanguageService.Base" />
4543
<InternalsVisibleTo Include="FSharp.Compiler.Server.Shared" />
4644
<InternalsVisibleTo Include="VisualFSharp.Salsa" />
4745
<InternalsVisibleTo Include="VisualFSharp.UnitTests" />

vsintegration/src/FSharp.LanguageService/GotoDefinition.fs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@
55
namespace Microsoft.VisualStudio.FSharp.LanguageService
66

77
open System
8-
open System.IO
9-
open System.Collections.Generic
108
open System.Diagnostics
119
open Microsoft.VisualStudio
12-
open Microsoft.VisualStudio.Shell
13-
open Microsoft.VisualStudio.Shell.Interop
1410
open Microsoft.VisualStudio.TextManager.Interop
1511
open FSharp.Compiler
16-
open FSharp.Compiler.Lib
1712
open FSharp.Compiler.SourceCodeServices
1813

1914
module internal OperatorToken =
2015

2116
let asIdentifier_DEPRECATED (token : TokenInfo) =
2217
// Typechecker reports information about all values in the same fashion no matter whether it is named value (let binding) or operator
2318
// here we piggyback on this fact and just pretend that we need data time for identifier
24-
let tagOfIdentToken = FSharp.Compiler.Parser.tagOfToken(FSharp.Compiler.Parser.IDENT "")
19+
20+
let tagOfIdentToken = FSharpTokenTag.IDENT
21+
2522
let endCol = token.EndIndex + 1 // EndIndex from GetTokenInfoAt points to the last operator char, but here it should point to column 'after' the last char
2623
tagOfIdentToken, token.StartIndex, endCol
2724

@@ -69,7 +66,9 @@ module internal GotoDefinition =
6966
|> GotoDefinitionResult_DEPRECATED.MakeError
7067
| Some(colIdent, tag, qualId) ->
7168
if typedResults.HasFullTypeCheckInfo then
72-
if Parser.tokenTagToTokenId tag <> Parser.TOKEN_IDENT then
69+
// Used to be the Parser's internal definition, now hard-coded to avoid an IVT into the parser itsef.
70+
// Dead code (aside from legacy tests), ignore
71+
if tag <> FSharpTokenTag.IDENT then
7372
Strings.GotoDefinitionFailed_NotIdentifier()
7473
|> GotoDefinitionResult_DEPRECATED.MakeError
7574
else

vsintegration/src/FSharp.LanguageService/Intellisense.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ type internal FSharpDeclarations_DEPRECATED(documentationBuilder, declarations:
224224
// We intercept this call only to get the initial extent
225225
// of what was committed to the source buffer.
226226
let result = decl.GetName(filterText, index)
227-
FSharp.Compiler.Lexhelp.Keywords.QuoteIdentifierIfNeeded result
227+
Keywords.QuoteIdentifierIfNeeded result
228228

229229
override decl.IsCommitChar(commitCharacter) =
230230
// Usual language identifier rules...

vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,6 @@ type UsingMSBuild() =
101101
n
102102
) 0
103103

104-
105-
[<Test>]
106-
member public this.``PublicSurfaceArea.DotNetReflection``() =
107-
let ps = publicTypesInAsm @"FSharp.ProjectSystem.FSharp.dll"
108-
Assert.AreEqual(1, ps) // BuildPropertyDescriptor
109-
let ls = publicTypesInAsm @"FSharp.LanguageService.dll"
110-
Assert.AreEqual(0, ls)
111-
let compis = publicTypesInAsm @"FSharp.Compiler.Interactive.Settings.dll"
112-
Assert.AreEqual(5, compis)
113-
let compserver = publicTypesInAsm @"FSharp.Compiler.Server.Shared.dll"
114-
Assert.AreEqual(0, compserver)
115-
let lsbase = publicTypesInAsm @"FSharp.LanguageService.Base.dll"
116-
Assert.AreEqual(0, lsbase)
117-
let psbase = publicTypesInAsm @"FSharp.ProjectSystem.Base.dll"
118-
Assert.AreEqual(17, psbase)
119-
let fsi = publicTypesInAsm @"FSharp.VS.FSI.dll"
120-
Assert.AreEqual(1, fsi)
121-
122-
123104
[<Test>]
124105
member public this.``ReconcileErrors.Test1``() =
125106
let (_solution, project, file) = this.CreateSingleFileProject(["erroneous"])

0 commit comments

Comments
 (0)