public TypeLookupResponse GetTypeLookupResponse(TypeLookupRequest request) { var res = _bufferParser.ParsedContent(request.Buffer, request.FileName); var loc = new TextLocation(request.Line, request.Column); var resolveResult = ResolveAtLocation.Resolve(res.Compilation, res.UnresolvedFile, res.SyntaxTree, loc); var response = new TypeLookupResponse(); var ambience = new CSharpAmbience() { ConversionFlags = AmbienceFlags, }; if (resolveResult == null || resolveResult is NamespaceResolveResult) response.Type = ""; else { response.Type = resolveResult.Type.ToString(); IEntity entity = null; if (resolveResult is CSharpInvocationResolveResult) { var result = resolveResult as CSharpInvocationResolveResult; entity = result.Member; response.Type = ambience.ConvertSymbol(result.Member); } else if (resolveResult is LocalResolveResult) { var result = resolveResult as LocalResolveResult; response.Type = ambience.ConvertVariable(result.Variable); } else if (resolveResult is MemberResolveResult) { var result = resolveResult as MemberResolveResult; entity = result.Member; response.Type = ambience.ConvertSymbol(result.Member); } else if (resolveResult is TypeResolveResult) { ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedTypeNames; response.Type = ambience.ConvertType(resolveResult.Type); } if (resolveResult.Type is UnknownType) response.Type = "Unknown Type: " + resolveResult.Type.Name; if (resolveResult.Type == SpecialType.UnknownType) response.Type = "Unknown Type"; if (request.IncludeDocumentation && entity != null) { var project = _solution.ProjectContainingFile(request.FileName); response.Documentation = new DocumentationFetcher().GetDocumentation(project, entity, _config); } } return response; }
public TypeLookupResponse GetTypeLookupResponse(TypeLookupRequest request) { var res = _bufferParser.ParsedContent(request.Buffer, request.FileName); var loc = new TextLocation(request.Line, request.Column); var resolveResult = ResolveAtLocation.Resolve(res.Compilation, res.UnresolvedFile, res.SyntaxTree, loc); var response = new TypeLookupResponse(); var ambience = new CSharpAmbience() { ConversionFlags = AmbienceFlags, }; if (resolveResult == null || resolveResult is NamespaceResolveResult) { response.Type = ""; } else if (resolveResult != null) { response.Type = resolveResult.Type.ToString(); if (resolveResult is CSharpInvocationResolveResult) { var result = resolveResult as CSharpInvocationResolveResult; response.Type = ambience.ConvertEntity(result.Member); } else if (resolveResult is LocalResolveResult) { var result = resolveResult as LocalResolveResult; response.Type = ambience.ConvertVariable(result.Variable); } else if (resolveResult is MemberResolveResult) { var result = resolveResult as MemberResolveResult; response.Type = ambience.ConvertEntity(result.Member); } else if (resolveResult is TypeResolveResult) { ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedTypeNames; response.Type = ambience.ConvertType(resolveResult.Type); } if (resolveResult.Type is UnknownType) { response.Type = "Unknown Type: " + resolveResult.Type.Name; } if (resolveResult.Type == SpecialType.UnknownType) { response.Type = "Unknown Type"; } } return(response); }
public TypeLookupResponse GetTypeLookupResponse(TypeLookupRequest request) { var res = _bufferParser.ParsedContent(request.Buffer, request.FileName); var loc = new TextLocation(request.Line, request.Column); var resolveResult = ResolveAtLocation.Resolve(res.Compilation, res.UnresolvedFile, res.SyntaxTree, loc); var response = new TypeLookupResponse(); var ambience = new CSharpAmbience() { ConversionFlags = AmbienceFlags, }; if (resolveResult == null || resolveResult is NamespaceResolveResult) response.Type = ""; else if (resolveResult != null) { response.Type = resolveResult.Type.ToString(); if (resolveResult is CSharpInvocationResolveResult) { var result = resolveResult as CSharpInvocationResolveResult; response.Type = ambience.ConvertEntity(result.Member); } else if (resolveResult is LocalResolveResult) { var result = resolveResult as LocalResolveResult; response.Type = ambience.ConvertVariable(result.Variable); } else if (resolveResult is MemberResolveResult) { var result = resolveResult as MemberResolveResult; response.Type = ambience.ConvertEntity(result.Member); } else if (resolveResult is TypeResolveResult) { ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedTypeNames; response.Type = ambience.ConvertType(resolveResult.Type); } if (resolveResult.Type is UnknownType) response.Type = "Unknown Type: " + resolveResult.Type.Name; if (resolveResult.Type == SpecialType.UnknownType) response.Type = "Unknown Type"; } return response; }
public TypeLookupResponse GetTypeLookupResponse(TypeLookupRequest request) { var res = _bufferParser.ParsedContent(request.Buffer, request.FileName); var loc = new TextLocation(request.Line, request.Column); var resolveResult = ResolveAtLocation.Resolve(res.Compilation, res.UnresolvedFile, res.SyntaxTree, loc); var response = new TypeLookupResponse(); var ambience = new CSharpAmbience() { ConversionFlags = AmbienceFlags, }; if (resolveResult == null || resolveResult is NamespaceResolveResult) { response.Type = ""; } else { response.Type = resolveResult.Type.ToString(); IEntity entity = null; if (resolveResult is CSharpInvocationResolveResult) { var result = resolveResult as CSharpInvocationResolveResult; entity = result.Member; response.Type = ambience.ConvertSymbol(result.Member); } else if (resolveResult is LocalResolveResult) { var result = resolveResult as LocalResolveResult; response.Type = ambience.ConvertVariable(result.Variable); } else if (resolveResult is MemberResolveResult) { var result = resolveResult as MemberResolveResult; entity = result.Member; response.Type = ambience.ConvertSymbol(result.Member); } else if (resolveResult is TypeResolveResult) { ambience.ConversionFlags |= ConversionFlags.UseFullyQualifiedTypeNames; response.Type = ambience.ConvertType(resolveResult.Type); } if (resolveResult.Type is UnknownType) { response.Type = "Unknown Type: " + resolveResult.Type.Name; } if (resolveResult.Type == SpecialType.UnknownType) { response.Type = "Unknown Type"; } if (request.IncludeDocumentation && entity != null) { var project = _solution.ProjectContainingFile(request.FileName); response.Documentation = new DocumentationFetcher().GetDocumentation(project, entity, _config); } } return(response); }