Ionide-vscode-fsharp: Rename operation on methods or say record fields result in full replace of dot syntax path with renamed symbol

Created on 2 Jan 2019  路  7Comments  路  Source: ionide/ionide-vscode-fsharp

Rename operation on methods or say record fields result in full replace of dot syntax path with renamed symbol.

Renaming currently replaces symbols like this:

type Foo = { BeforeRename: int }

let usage (x: Foo) = 
   x.BeforeRename

Renaming BeforeRename to AfterRename breaks every location that uses it through dot syntax.
See example:

type Foo = { AfterRename: int }

let usage (x: Foo) = 
   AfterRename // Error here

This basically happens with every symbol that could be accessed through dot syntax and has been happening for quite some months, surprised I couldn't find an open issue already.

bug

Most helpful comment

Fixed by c6fa8e5dea4f8e2171aaa897956dd99513dd7697

All 7 comments

Same thing occurs with modules

module Oof =
    let dooter () =
        "asdf"

module Foo =
    let doTheFoo() =
        printfn "%s" (Oof.dooter())

Renaming to dewter

module Oof =
    let dewter () =
        "asdf"

module Foo =
    let doTheFoo() =
        printfn "%s" (dewter())

This also happens with any functions in modules where you are accessing them with a prefix.

module Common =
    let myCommonFunction param =
        ...

// Somewhere else
let result = Common.myCommonFunction param

// After rename refactoring myCommonFunction to commonFunction
let result = commonFunction // <- Should be Common.commonFunction

Definitely very frustrating.

I haven't really taken a look at Ionide's code before, but if anyone is familiar, is this the entry point I'd be looking at to fix this?

https://github.com/ionide/ionide-vscode-fsharp/blob/master/src/Components/Rename.fs

@weebs The file you linked if the one responsible to edit the file indeed. However, it calling LanguageService.symbolUseProject in order to get all the symbols locations to rename.

And so the logic to find the symbols and their location is implements in FSAC.

I think the entry point for FSAC is here

Symbol finding logic seems fine - the whole qualified name is a symbol. So I think it should be fixed on the Ionide side - rename implementation should handle symbols containing .

That's probably my fault.
https://github.com/ionide/ionide-vscode-fsharp/pull/890/files
I tried to fix renaming with ``, but also broke the symbols with .

Fixed by c6fa8e5dea4f8e2171aaa897956dd99513dd7697

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cloudRoutine picture cloudRoutine  路  5Comments

alfonsogarciacaro picture alfonsogarciacaro  路  5Comments

draganjovanovic1 picture draganjovanovic1  路  3Comments

cartermp picture cartermp  路  4Comments

sivabudh picture sivabudh  路  3Comments