public static FormatPath ( this path, UriKind kind, string basePath = null ) : string | ||
path | this | |
kind | UriKind | |
basePath | string | |
return | string |
public static SourceDetail GetSourceDetail(ISymbol symbol) { // For namespace, definition is meaningless if (symbol == null || symbol.Kind == SymbolKind.Namespace) { return(null); } var syntaxRef = symbol.DeclaringSyntaxReferences.LastOrDefault(); if (symbol.IsExtern || syntaxRef == null) { return(new SourceDetail { IsExternalPath = true, Path = symbol.ContainingAssembly?.Name, }); } var syntaxNode = syntaxRef.GetSyntax(); Debug.Assert(syntaxNode != null); if (syntaxNode != null) { var source = new SourceDetail { StartLine = syntaxNode.SyntaxTree.GetLineSpan(syntaxNode.Span).StartLinePosition.Line, Path = syntaxNode.SyntaxTree.FilePath, Name = symbol.Name }; source.Remote = GitUtility.GetGitDetail(source.Path); if (source.Remote != null) { source.Path = TypeForwardedToPathUtility.FormatPath(source.Path, UriKind.Relative, source.Remote.LocalWorkingDirectory); } return(source); } return(null); }