예제 #1
0
        private IDocumentPeekResult CreateResult(IAnalysisVariable variable)
        {
            var fileName = PathUtils.GetFileOrDirectoryName(variable.Location.FilePath);

            var displayInfo = new PeekResultDisplayInfo2(
                label: string.Format("{0} - ({1}, {2})", fileName, variable.Location.StartLine, variable.Location.StartColumn),
                labelTooltip: variable.Location.FilePath,
                title: fileName,
                titleTooltip: variable.Location.FilePath,
                startIndexOfTokenInLabel: 0,
                lengthOfTokenInLabel: 0
                );

            return(_peekResultFactory.Create(
                       displayInfo,
                       default(ImageMoniker),
                       variable.Location.FilePath,
                       variable.DefinitionLocation.StartLine - 1,
                       variable.DefinitionLocation.StartColumn - 1,
                       (variable.DefinitionLocation.EndLine ?? variable.DefinitionLocation.StartLine) - 1,
                       (variable.DefinitionLocation.EndColumn ?? variable.DefinitionLocation.StartColumn) - 1,
                       variable.Location.StartLine - 1,
                       variable.Location.StartColumn - 1,
                       (variable.Location.EndLine ?? variable.Location.StartLine) - 1,
                       (variable.Location.EndColumn ?? variable.Location.StartColumn) - 1,
                       isReadOnly: false
                       ));
        }
예제 #2
0
        private IDocumentPeekResult CreateResult()
        {
            var tokenLine  = _token.GetLine();
            var lineNumber = tokenLine.LineNumber;

            const int startLineIndex = 0;
            var       endLineIndex   = tokenLine.LineEnd;
            var       idIndex        = _token.GetStart() - tokenLine.LineStart;
            var       path           = _token.Document.Path;

            var displayInfo = new PeekResultDisplayInfo(
                label: path,
                labelTooltip: path,
                title: path,
                titleTooltip: path);

            return(_peekResultFactory.Create(
                       displayInfo,
                       path,
                       lineNumber,
                       startLineIndex,
                       lineNumber,
                       endLineIndex,
                       idLine: lineNumber,
                       idIndex: idIndex
                       ));
        }
예제 #3
0
 internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, PeekResultDisplayInfo displayInfo, IPeekResultFactory peekResultFactory, bool isReadOnly)
 {
     return(peekResultFactory.Create(
                displayInfo,
                filePath: filePath,
                startLine: entityOfInterestSpan.Start.Line,
                startIndex: entityOfInterestSpan.Start.Character,
                endLine: entityOfInterestSpan.End.Line,
                endIndex: entityOfInterestSpan.End.Character,
                idLine: identifierLocation.Start.Line,
                idIndex: identifierLocation.Start.Character,
                isReadOnly: isReadOnly));
 }
예제 #4
0
 internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, PeekResultDisplayInfo displayInfo, IPeekResultFactory peekResultFactory, bool isReadOnly)
 {
     return peekResultFactory.Create(
         displayInfo,
         filePath: filePath,
         startLine: entityOfInterestSpan.Start.Line,
         startIndex: entityOfInterestSpan.Start.Character,
         endLine: entityOfInterestSpan.End.Line,
         endIndex: entityOfInterestSpan.End.Character,
         idLine: identifierLocation.Start.Line,
         idIndex: identifierLocation.Start.Character,
         isReadOnly: isReadOnly);
 }
예제 #5
0
        private IDocumentPeekResult CreateResult(AnalysisLocation location)
        {
            var fileName = PathUtils.GetFileOrDirectoryName(location.FilePath);

            var displayInfo = new PeekResultDisplayInfo2(
                label: string.Format("{0} - ({1}, {2})", fileName, location.Line, location.Column),
                labelTooltip: location.FilePath,
                title: fileName,
                titleTooltip: location.FilePath,
                startIndexOfTokenInLabel: 0,
                lengthOfTokenInLabel: 0
                );

            int startLine   = location.Line - 1;
            int startColumn = location.Column - 1;
            int endLine     = startLine;
            int endColumn   = startColumn;

            if (location.DefinitionStartLine.HasValue)
            {
                startLine = location.DefinitionStartLine.Value - 1;
            }
            if (location.DefinitionStartColumn.HasValue)
            {
                startColumn = location.DefinitionStartColumn.Value - 1;
            }
            if (location.DefinitionEndLine.HasValue)
            {
                endLine = location.DefinitionEndLine.Value - 1;
            }
            if (location.DefinitionEndColumn.HasValue)
            {
                endColumn = location.DefinitionEndColumn.Value - 1;
            }

            return(_peekResultFactory.Create(
                       displayInfo,
                       default(ImageMoniker),
                       location.FilePath,
                       startLine,
                       startColumn,
                       endLine,
                       endColumn,
                       location.Line - 1,
                       location.Column - 1,
                       location.Line - 1,
                       location.Column - 1,
                       isReadOnly: false,
                       editorDestination: new Guid(PythonConstants.EditorFactoryGuid)
                       ));
        }