diff options
author | nosami <jasonimison@gmail.com> | 2019-07-02 18:42:24 +0300 |
---|---|---|
committer | nosami <jasonimison@gmail.com> | 2019-07-02 18:44:56 +0300 |
commit | 00db72401bed3e43ec4267f9cd331a0ec7060343 (patch) | |
tree | 1fb3be4473194c93f9367a288f6b32f2be987863 /main/external/fsharpbinding | |
parent | f973377cee25721c787f72d006694fab248b758e (diff) |
Fix F# semantic highlighting
Fixes VSTS #939713
Semantic highlighting was not working at all. Only regex highlighting was being used.
Diffstat (limited to 'main/external/fsharpbinding')
3 files changed, 10 insertions, 20 deletions
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpParser.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpParser.fs index 9260f137fb..fd1a83c5b5 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpParser.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpParser.fs @@ -104,7 +104,7 @@ type FSharpParser() = let shortFilename = Path.GetFileName filename try if not token.IsCancellationRequested then - match MonoDevelop.tryGetVisibleDocument filename with + match MonoDevelop.tryGetVisibleDocument (filename |> FilePath) with | Some doc -> let newVersion = doc.Editor.Version if newVersion.BelongsToSameDocumentAs(version) && newVersion.CompareAge(version) = 0 then @@ -128,7 +128,7 @@ type FSharpParser() = let proj = parseOptions.Project - let doc = MonoDevelop.tryGetVisibleDocument fileName + let doc = MonoDevelop.tryGetVisibleDocument (fileName |> FilePath) if doc.IsNone || not (FileService.supportedFileName (fileName)) then null else diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpSyntaxMode.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpSyntaxMode.fs index d3e311e3ce..25315857c5 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpSyntaxMode.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpSyntaxMode.fs @@ -1,14 +1,11 @@ namespace MonoDevelop.FSharp -open System open System.Collections.Generic -open System.Collections.Immutable open MonoDevelop.FSharp.Shared -open MonoDevelop.Ide open MonoDevelop.Ide.Editor open MonoDevelop.Ide.Editor.Highlighting +open MonoDevelop.Ide.Gui open MonoDevelop.Core -open Mono.TextEditor.Highlighting open FSharp.Compiler open FSharp.Compiler.SourceCodeServices open ExtCore.Control @@ -357,18 +354,13 @@ module Patterns = | _ -> Seq.empty -type FSharpSyntaxMode(editor, context) = +type FSharpSyntaxMode(editor, context: DocumentContext) = inherit SemanticHighlighting(editor, context) let tokenssymbolscolours = ref None - //let style = ref (getColourScheme()) - //let colourSchemChanged = - // IdeApp.Preferences.ColorScheme.Changed.Subscribe - // (fun _ (eventArgs:EventArgs) -> - // let colourStyles = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme.Value) - // (*style := colourStyles*) ) - + let roslynContext = context :?> RoslynDocumentContext + override x.DocumentParsed() = - if MonoDevelop.isDocumentVisible context.Name then + if MonoDevelop.isDocumentVisible roslynContext.FileName then SyntaxMode.tryGetTokensSymbolsAndColours context |> Option.iter (fun tsc -> tokenssymbolscolours := Some tsc Application.Invoke(fun _ _ -> x.NotifySemanticHighlightingUpdate())) @@ -378,6 +370,4 @@ type FSharpSyntaxMode(editor, context) = let lineNumber = line.LineNumber let txt = editor.GetLineText line - SyntaxMode.getColouredSegment !tokenssymbolscolours lineNumber line.Offset txt// !style - - //interface IDisposable with member x.Dispose() = colourSchemChanged.Dispose()
\ No newline at end of file + SyntaxMode.getColouredSegment !tokenssymbolscolours lineNumber line.Offset txt diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/MDLanguageService.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/MDLanguageService.fs index 020984818f..06209a5ac9 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/MDLanguageService.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/MDLanguageService.fs @@ -75,11 +75,11 @@ module MonoDevelop = let isDocumentVisible filename = visibleDocuments() - |> Seq.exists (fun d -> d.FileName.ToString() = filename) + |> Seq.exists (fun d -> d.FileName = filename) let tryGetVisibleDocument filename = visibleDocuments() - |> Seq.tryFind (fun d -> d.FileName.ToString() = filename) + |> Seq.tryFind (fun d -> d.FileName = filename) /// Provides functionality for working with the F# interactive checker running in background |