Repository navigation
Implement rename in LS - #16
Conversation
| using System.Diagnostics; | ||
|
|
||
| namespace Microsoft.PythonTools.Analysis.Infrastructure { | ||
| public class LinearSpan { |
There was a problem hiding this comment.
One more span?
There was a problem hiding this comment.
SourceSpan is line/column, LinearSpan is index/length, like TextRange in RTVS.
There was a problem hiding this comment.
Maybe rename it into TextRange then?
There was a problem hiding this comment.
It is all confusing... Code base uses 'span' as VS does, i.e. SourceSpan. However, VS Code and LSP uses Range which is also line/column. So I thought about more explicit name that a) shows it is stream/linear coordinates and is not Range not to confuse with LSP. Also, technically it can be anything (start/count), not just text.
There was a problem hiding this comment.
Ok, let's leave it as it is.
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </Content> | ||
| </ItemGroup> | ||
| <ItemGroup> |
|
|
||
| public virtual Task<WorkspaceEdit> Rename(RenameParams @params) => throw new NotImplementedException(); | ||
| public virtual Task<WorkspaceEdit> Rename(RenameParams @params) => Rename(@params, CancellationToken.None); | ||
| public virtual Task<WorkspaceEdit> Rename(RenameParams @params, CancellationToken cancellationToken) => throw new NotImplementedException(); |
There was a problem hiding this comment.
Ignore previous comment
| throw new InvalidOperationException(Resources.RenameVariable_UnableGetExpressionAnalysis); | ||
| } | ||
|
|
||
| var references = await FindReferences(new ReferencesParams { |
There was a problem hiding this comment.
I would've call entry.GetAnalysisAsync before FindReferences.
There was a problem hiding this comment.
FindReferences calls it internally
|
👍 |
Implement rename in LS
https://github.com/Microsoft/PTVS/blob/master/Python/Product/PythonTools/PythonTools/Refactoring/VariableRenamer.cs
https://github.com/Microsoft/PTVS/blob/master/Python/Product/PythonTools/PythonTools/Refactoring/LocationPreviewItem.cs