Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Implement rename in LS - #16

Merged
Mikhail Arkhipov (MikhailArkhipov) merged 4 commits into
microsoft:masterfrom
MikhailArkhipov:rename
Sep 4, 2018
Merged

Mikhail Arkhipov (MikhailArkhipov) merged 4 commits into
microsoft:masterfrom
MikhailArkhipov:rename

Conversation

@MikhailArkhipov

Copy link
Copy Markdown
  • some files moved around

using System.Diagnostics;

namespace Microsoft.PythonTools.Analysis.Infrastructure {
public class LinearSpan {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more span?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceSpan is line/column, LinearSpan is index/length, like TextRange in RTVS.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename it into TextRange then?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's leave it as it is.

<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore previous comment

throw new InvalidOperationException(Resources.RenameVariable_UnableGetExpressionAnalysis);
}

var references = await FindReferences(new ReferencesParams {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've call entry.GetAnalysisAsync before FindReferences.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FindReferences calls it internally

@AlexanderSher

Copy link
Copy Markdown
Contributor

👍

@MikhailArkhipov
Mikhail Arkhipov (MikhailArkhipov) merged commit 1b03a78 into microsoft:master Sep 4, 2018
Jake Bailey (jakebailey) pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants