Skip to content

Commit

Permalink
Merge branch 'release/fsharp47' into feature/nameof
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom authored Jun 18, 2019
2 parents 5200435 + 13f9eaf commit 7c9bfe5
Show file tree
Hide file tree
Showing 39 changed files with 438 additions and 559 deletions.
2 changes: 1 addition & 1 deletion RoslynPackageVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0-beta3-19222-02
3.2.0-beta4-19312-15
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json;
https://api.nuget.org/v3/index.json;
https://dotnet.myget.org/F/roslyn/api/v3/index.json;
https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json;
https://dotnet.myget.org/F/symreader-converter/api/v3/index.json;
https://dotnet.myget.org/F/interactive-window/api/v3/index.json;
https://myget.org/F/vs-devcore/api/v3/index.json;
Expand Down
3 changes: 2 additions & 1 deletion eng/targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
</PropertyGroup>

<PropertyGroup>
<IncludeVsLanguageServer>true</IncludeVsLanguageServer>
<!-- this should be false for branch `release/dev16.2`, true otherwise -->
<IncludeVsLanguageServer>false</IncludeVsLanguageServer>
</PropertyGroup>

</Project>
6 changes: 3 additions & 3 deletions fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@
<Compile Include="$(FSharpSourcesRoot)/absil/ilreflect.fs">
<Link>AbsIL/ilreflect.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\utils\reshapedmsbuild.fs">
<Link>ReferenceResolution/reshapedmsbuild.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/ReferenceResolver.fs">
<Link>ReferenceResolution/ReferenceResolver.fs</Link>
</Compile>
Expand Down Expand Up @@ -593,9 +596,6 @@
<Compile Include="$(FSharpSourcesRoot)\fsharp\service\ServiceUntypedParse.fs">
<Link>Service/ServiceUntypedParse.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\utils\reshapedmsbuild.fs">
<Link>Service/reshapedmsbuild.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)\fsharp\service\ServiceDeclarationLists.fsi">
<Link>Service/ServiceDeclarationLists.fsi</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@
<Link>Service/reshapedmsbuild.fs</Link>
</Compile>

<Compile Include="..\..\utils\reshapedmsbuild.fs">
<Link>ReferenceResolution/reshapedmsbuild.fs</Link>
</Compile>
<!-- A legacy resolver used to help with scripting diagnostics in the Visual Studio tools -->
<Compile Include="..\LegacyMSBuildReferenceResolver.fsi">
<Link>ReferenceResolution/LegacyMSBuildReferenceResolver.fsi</Link>
Expand Down
9 changes: 6 additions & 3 deletions src/fsharp/service/FSharpCheckerResults.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,8 +1526,11 @@ module internal ParseAndCheckFile =
let tokenizer = LexFilter.LexFilter(lightSyntaxStatus, options.CompilingFsLib, Lexer.token lexargs true, lexbuf)
tokenizer.Lexer

// Public callers are unable to answer LanguageVersion feature support questions.
// External Tools including the VS IDE will enable the default LanguageVersion
let isFeatureSupported (_featureId:LanguageFeature) = true
let createLexbuf sourceText =

let createLexbuf sourceText isFeatureSupported =
UnicodeLexing.SourceTextAsLexbuf(isFeatureSupported, sourceText)

let matchBraces(sourceText: ISourceText, fileName, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool) =
Expand All @@ -1543,7 +1546,7 @@ module internal ParseAndCheckFile =
use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse

let matchingBraces = new ResizeArray<_>()
Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf ->
Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf ->
let errHandler = ErrorHandler(false, fileName, options.ErrorSeverityOptions, sourceText, suggestNamesForErrors)
let lexfun = createLexerFunction fileName options lexbuf errHandler
let parenTokensBalance t1 t2 =
Expand Down Expand Up @@ -1579,7 +1582,7 @@ module internal ParseAndCheckFile =
use unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse

let parseResult =
Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf ->
Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf ->
let lexfun = createLexerFunction fileName options lexbuf errHandler
let isLastCompiland =
fileName.Equals(options.LastFileName, StringComparison.CurrentCultureIgnoreCase) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
<Action Type="Ngen" Path="FSharp.ProjectSystem.FSharp.dll" />
<Action Type="Ngen" Path="FSharp.ProjectSystem.PropertyPages.dll" />
<Action Type="Ngen" Path="FSharp.VS.FSI.dll" />
<!-- this Ngen action should be disabled in branch `release/dev16.2`, enabled otherwise -->
<!--
<Action Type="Ngen" Path="Agent\FSharp.Compiler.LanguageServer.exe" />
-->
</Actions>
</Installer>
<Dependencies>
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion vsintegration/src/FSharp.Editor/CodeFix/RemoveUnusedOpens.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ open Microsoft.CodeAnalysis.Diagnostics
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.CodeFixes
open Microsoft.CodeAnalysis.CodeActions
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics

open FSharp.Compiler.Range

Expand All @@ -21,7 +22,7 @@ type internal FSharpRemoveUnusedOpensCodeFixProvider
projectInfoManager: FSharpProjectOptionsManager
) =
inherit CodeFixProvider()
let fixableDiagnosticIds = [IDEDiagnosticIds.RemoveUnnecessaryImportsDiagnosticId]
let fixableDiagnosticIds = [FSharpIDEDiagnosticIds.RemoveUnnecessaryImportsDiagnosticId]

let createCodeFix (title: string, context: CodeFixContext) =
CodeAction.Create(
Expand Down
5 changes: 3 additions & 2 deletions vsintegration/src/FSharp.Editor/CodeFix/SimplifyName.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Diagnostics
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.CodeFixes
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
open SymbolHelpers

[<ExportCodeFixProvider(FSharpConstants.FSharpLanguageName, Name = PredefinedCodeFixProviderNames.SimplifyNames); Shared>]
[<ExportCodeFixProvider(FSharpConstants.FSharpLanguageName, Name = "SimplifyNames"); Shared>]
type internal FSharpSimplifyNameCodeFixProvider() =
inherit CodeFixProvider()
let fixableDiagnosticId = IDEDiagnosticIds.SimplifyNamesDiagnosticId
let fixableDiagnosticId = FSharpIDEDiagnosticIds.SimplifyNamesDiagnosticId

override __.FixableDiagnosticIds = ImmutableArray.Create(fixableDiagnosticId)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ open System.Windows.Media.Animation
open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Editor.Shared.Extensions
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Extensions

open FSharp.Compiler
open FSharp.Compiler.SourceCodeServices
Expand Down Expand Up @@ -91,7 +92,7 @@ type internal FSharpCodeLensService
logInfof "Tagged text %A" taggedText
#endif
let textBlock = new TextBlock(Background = Brushes.AliceBlue, Opacity = 0.0, TextTrimming = TextTrimming.None)
DependencyObjectExtensions.SetDefaultTextProperties(textBlock, formatMap.Value)
FSharpDependencyObjectExtensions.SetDefaultTextProperties(textBlock, formatMap.Value)

let prefix = Documents.Run settings.CodeLens.Prefix
prefix.Foreground <- SolidColorBrush(Color.FromRgb(153uy, 153uy, 153uy))
Expand All @@ -116,7 +117,7 @@ type internal FSharpCodeLensService
coloredProperties.SetForeground(Color.FromRgb(153uy, 153uy, 153uy))

let run = Documents.Run text.Text
DependencyObjectExtensions.SetTextProperties (run, actualProperties)
FSharpDependencyObjectExtensions.SetTextProperties (run, actualProperties)

let inl =
match text with
Expand All @@ -126,7 +127,7 @@ type internal FSharpCodeLensService
navigation.NavigateTo nav.Range)
h :> Documents.Inline
| _ -> run :> _
DependencyObjectExtensions.SetTextProperties (inl, actualProperties)
FSharpDependencyObjectExtensions.SetTextProperties (inl, actualProperties)
textBlock.Inlines.Add inl


Expand Down
20 changes: 0 additions & 20 deletions vsintegration/src/FSharp.Editor/Common/ContentType.fs

This file was deleted.

8 changes: 0 additions & 8 deletions vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ module internal RoslynHelpers =
let StartAsyncUnitAsTask cancellationToken (computation:Async<unit>) =
StartAsyncAsTask cancellationToken computation :> Task

let private TheSupportedDiagnostics =
// We are constructing our own descriptors at run-time. Compiler service is already doing error formatting and localization.
let dummyDescriptors =
[| for i in 0 .. 10000 -> DiagnosticDescriptor(sprintf "FS%04d" i, String.Empty, String.Empty, String.Empty, DiagnosticSeverity.Error, true, null, null) |]
ImmutableArray.Create<DiagnosticDescriptor>(dummyDescriptors)

let SupportedDiagnostics() = TheSupportedDiagnostics

let ConvertError(error: FSharpErrorInfo, location: Location) =
// Normalize the error message into the same format that we will receive it from the compiler.
// This ensures that IntelliSense and Compiler errors in the 'Error List' are de-duplicated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Completion
open Microsoft.CodeAnalysis.Options
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion

open Microsoft.VisualStudio.Shell

Expand Down Expand Up @@ -48,7 +49,7 @@ type internal FSharpCompletionProvider
|> List.filter (fun (keyword, _) -> not (PrettyNaming.IsOperatorName keyword))
|> List.sortBy (fun (keyword, _) -> keyword)
|> List.mapi (fun n (keyword, description) ->
CommonCompletionItem.Create(keyword, null, CompletionItemRules.Default, Nullable Glyph.Keyword, sortText = sprintf "%06d" (1000000 + n))
FSharpCommonCompletionItem.Create(keyword, null, CompletionItemRules.Default, Nullable Glyph.Keyword, sortText = sprintf "%06d" (1000000 + n))
.AddProperty("description", description)
.AddProperty(IsKeywordPropName, ""))

Expand All @@ -73,7 +74,7 @@ type internal FSharpCompletionProvider
// * let xs = [1..10] <<---- Don't commit autocomplete! (same for arrays)
let noCommitChars = [|' '; '='; ','; '.'; '<'; '>'; '('; ')'; '!'; ':'; '['; ']'; '|'|].ToImmutableArray()

CompletionItemRules.Default.WithCommitCharacterRule(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, noCommitChars))
CompletionItemRules.Default.WithCommitCharacterRules(ImmutableArray.Create (CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, noCommitChars)))

static let getRules showAfterCharIsTyped = if showAfterCharIsTyped then noCommitOnSpaceRules else CompletionItemRules.Default

Expand Down Expand Up @@ -152,7 +153,7 @@ type internal FSharpCompletionProvider
| _, idents -> Array.last idents

let completionItem =
CommonCompletionItem.Create(name, null, rules = getRules intellisenseOptions.ShowAfterCharIsTyped, glyph = Nullable (Microsoft.CodeAnalysis.ExternalAccess.FSharp.FSharpGlyphHelpersObsolete.Convert(glyph)), filterText = filterText)
FSharpCommonCompletionItem.Create(name, null, rules = getRules intellisenseOptions.ShowAfterCharIsTyped, glyph = Nullable glyph, filterText = filterText)
.AddProperty(FullNamePropName, declarationItem.FullName)

let completionItem =
Expand Down Expand Up @@ -198,7 +199,7 @@ type internal FSharpCompletionProvider
}

override this.ShouldTriggerCompletion(sourceText: SourceText, caretPosition: int, trigger: CompletionTrigger, _: OptionSet) =
use _logBlock = Logger.LogBlockMessage this.Name LogEditorFunctionId.Completion_ShouldTrigger
use _logBlock = Logger.LogBlock LogEditorFunctionId.Completion_ShouldTrigger

let getInfo() =
let documentId = workspace.GetDocumentIdInCurrentContext(sourceText.Container)
Expand Down
10 changes: 6 additions & 4 deletions vsintegration/src/FSharp.Editor/Completion/CompletionService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Completion
open Microsoft.CodeAnalysis.Host
open Microsoft.CodeAnalysis.Host.Mef
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion

open Microsoft.VisualStudio.Shell

Expand All @@ -26,10 +27,11 @@ type internal FSharpCompletionService
let builtInProviders =
ImmutableArray.Create<CompletionProvider>(
FSharpCompletionProvider(workspace, serviceProvider, checkerProvider, projectInfoManager, assemblyContentProvider),
HashDirectiveCompletionProvider(workspace, projectInfoManager,
[ Completion.Create("""\s*#load\s+(@?"*(?<literal>"[^"]*"?))""", [".fs"; ".fsx"], useIncludeDirectives = true)
Completion.Create("""\s*#r\s+(@?"*(?<literal>"[^"]*"?))""", [".dll"; ".exe"], useIncludeDirectives = true)
Completion.Create("""\s*#I\s+(@?"*(?<literal>"[^"]*"?))""", ["\x00"], useIncludeDirectives = false) ]))
FSharpCommonCompletionProvider.Create(
HashDirectiveCompletionProvider(workspace, projectInfoManager,
[ Completion.Create("""\s*#load\s+(@?"*(?<literal>"[^"]*"?))""", [".fs"; ".fsx"], useIncludeDirectives = true)
Completion.Create("""\s*#r\s+(@?"*(?<literal>"[^"]*"?))""", [".dll"; ".exe"], useIncludeDirectives = true)
Completion.Create("""\s*#I\s+(@?"*(?<literal>"[^"]*"?))""", ["\x00"], useIncludeDirectives = false) ])))

override this.Language = FSharpConstants.FSharpLanguageName
override this.GetBuiltInProviders() = builtInProviders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Classification
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.Completion
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion
open System.Globalization
open FSharp.Compiler.SourceCodeServices

Expand Down Expand Up @@ -81,7 +82,7 @@ module internal CompletionUtils =
| _ -> false

let isStartingNewWord (sourceText, position) =
CommonCompletionUtilities.IsStartingNewWord(sourceText, position, (fun ch -> isIdentifierStartCharacter ch), (fun ch -> isIdentifierPartCharacter ch))
FSharpCommonCompletionUtilities.IsStartingNewWord(sourceText, position, (fun ch -> isIdentifierStartCharacter ch), (fun ch -> isIdentifierPartCharacter ch))

let shouldProvideCompletion (documentId: DocumentId, filePath: string, defines: string list, sourceText: SourceText, triggerPosition: int) : bool =
let textLines = sourceText.Lines
Expand Down
Loading

0 comments on commit 7c9bfe5

Please sign in to comment.