diff --git a/src/CSharpLanguageServer/DocumentationUtil.fs b/src/CSharpLanguageServer/DocumentationUtil.fs index 0f65a1c7..d38aaafa 100644 --- a/src/CSharpLanguageServer/DocumentationUtil.fs +++ b/src/CSharpLanguageServer/DocumentationUtil.fs @@ -1,9 +1,12 @@ namespace CSharpLanguageServer open System +open System.Linq open System.Xml.Linq +open System.Reflection open Microsoft.CodeAnalysis +open Microsoft.CodeAnalysis.CSharp.Syntax open CSharpLanguageServer.Conversions @@ -179,6 +182,24 @@ module DocumentationUtil = |> Option.map (fun a -> a.Name) |> Option.defaultValue "" + match sym with + | :? IRangeVariableSymbol as rangeVarSym -> + let underlyingSymList = rangeVarSym.GetType().GetMember("_underlying", BindingFlags.Instance|||BindingFlags.NonPublic) + let underlyingSymType = underlyingSymList.Single() :?> FieldInfo |> _.FieldType + + (sprintf "rangeVarSym.Type=%s; underlyingSym=%s" (rangeVarSym.GetType() |> string) + (underlyingSymType |> string)) + + //(sprintf "syntax=%s; type=%s" (syntax |> string) (syntax.GetType() |> string)) + (* + let typeInfo = semanticModel.GetTypeInfo(syntax) + (sprintf "typeInfo=%s; typeInfo.Type=\"%s\"" (typeInfo |> string) (typeInfo.Type |> string)) + let typeName = typeInfo.Type.ToDisplayString() + "o" + (sprintf "kind=%s, symbolName=%s, symAssemblyName=%s; typeName=%s" (string sym.Kind) symbolName symAssemblyName typeName) + *) + | _ -> "x" +(* let symbolInfoLines = match symbolName, symAssemblyName with | "", "" -> [] @@ -202,3 +223,4 @@ module DocumentationUtil = ) |> Seq.append symbolInfoLines |> (fun ss -> String.Join("\n", ss)) +*) diff --git a/src/CSharpLanguageServer/Handlers/Hover.fs b/src/CSharpLanguageServer/Handlers/Hover.fs index 76aeec89..7c795222 100644 --- a/src/CSharpLanguageServer/Handlers/Hover.fs +++ b/src/CSharpLanguageServer/Handlers/Hover.fs @@ -37,9 +37,15 @@ module Hover = RegisterOptions = registerOptions |> serialize |> Some } let handle (context: ServerRequestContext) (p: TextDocumentPositionParams) : AsyncLspResult = async { + let logMessage = context.WindowShowMessage + match! context.FindSymbol' p.TextDocument.Uri p.Position with - | None -> return None |> success + | None -> + do! logMessage "no symbol here!" + return None |> success + | Some (symbol, doc) -> + do! logMessage (sprintf "have symbol %s in doc %s" (string symbol) (string doc)) let! ct = Async.CancellationToken let! semanticModel = doc.GetSemanticModelAsync(ct) |> Async.AwaitTask let content = DocumentationUtil.markdownDocForSymbolWithSignature symbol semanticModel