-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement inline rename #1932
Implement inline rename #1932
Conversation
Wow. Fantastic to see this in progress! |
💋 |
@forki :) But it's not a small task, as it's turned out... |
@vasily-kirichenko I know. that's why you are doing it ;-) |
I've stuck with this a bit. That's how it works at the moment: What I think about it:
If this is all true, I'm afraid we have to modify
|
Tagging @jasonmalinowski and @dpoeschl for comments about how this works. |
I'll try to take a look today |
BIG thanks to @vladima for fixing this! It works like this now: What I have to finish:
|
@vladima I found an interesting bug: |
@vasily-kirichenko Looks like there are quite a few unrelated changes in this branch? Or do you need to merge with master? thx |
@dsyme You are right. Done. I will investigate the bug later. |
~28 failures, e.g.
|
I've reverted the |
The bug is a tricky one. If there are no text in the file after the renaming symbol, it pops up immediately, after deleting single character: If there is text after it, then it appears later, depending on the length of trailing text: I've compared our implementation to XAML one http://source.roslyn.io/#Microsoft.VisualStudio.LanguageServices.Xaml/Features/InlineRename/XamlEditorInlineRenameService.cs and found no differences. I've tested renaming in XAML editor, it works OK. Any ideas? |
…itorInlineRenameService, which is roslyn-AST bound
…t at the end position" This reverts commit af81683.
4a34df0
to
fe67eb9
Compare
@vasily-kirichenko This looks wrong (rename on a property |
Agreed, since this is cropping up in more than one feature area |
@dsyme could you comment on this? I mean is it by design:
? |
@vasily-kirichenko Something to consider either for this PR or a future one is how to deal with conflicts and preventing bad renames. For example: let getFirstFromTwople (t: int*int) = t |> fst
let getFirstFromThreeple (t: int*int*int) = t |> fst
let getFirstFromFourple (t: int*int*int*int) = t |> fst I can currently inline rename Another thing to consider is the Big Scary Warning Text for renaming something into something else in scope which has the same name, like in C#/VB: As an aside, I've been playing with this today and showing it off to people in the office. It's really, really great work. Kudos 😄 |
@cartermp yes, I already thought about this. We have quite good non scope aware name validation in VFPT, but it requires porting significant amount of code, including our own higher level wrapper over the lever for nicer qualified names parsing (or maybe not and we can use classifyAtPosition). What about name conflicts in same scope, I don't know how to get all names for current one. Never done this. However, I'd prefer to fix the bug (I have absolutely no idea how to do it) and make it solution wide (for all F# projects, making it work with other project types is a different unexplored area, however, the Xamarin guys have done it somehow, so we must be able to do it, too). |
@vasily-kirichenko Makes sense. |
Conflicts: vsintegration/src/FSharp.Editor/CommonHelpers.fs
Conflicts: vsintegration/packages.config
Conflicts: vsintegration/src/FSharp.Editor/CommonHelpers.fs vsintegration/src/FSharp.Editor/CommonRoslynHelpers.fs
* add InlineRenameService skeleton * implement IEditorInlineRenameService instead of inheriting AbstractEditorInlineRenameService, which is roslyn-AST bound * add some real logic into InlineRenameService * everything in place, but does not work yet * TryOnBefore/AfterGlobalSymbolRename should return `true` * some progress * port comments * add RenamedSpansTracker * trying to adjust span positions * fixes * do not check whole project in renamed symbol is local for file * update inline rename implementation * remove RenamedSpansTracker * fixed: CommonHelpers.tryClassifyAtPosition return wrong result at the end position * do not fix spans for now * Revert "fixed: CommonHelpers.tryClassifyAtPosition return wrong result at the end position" This reverts commit af81683. * refactoring * refactoring * use Async.Cache instead of mutable Task reference to emulate a non auto-starting promise * solution wide Inline Rename (wip) * fix after merge * update Microsoft.CodeAnalysis.xxx packages to 2.0.0-rc * fix after merge
This is early WIP of implementing Roslyn-powered Inline Rename.