-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
Rename of function and type does not work #1265
Comments
Hey @stoft 👋, Thank you for opening an issue. We will get back to you as https://opencollective.com/ionide
|
This should be fixed in |
Still not fixed unfortunately. Let me know if there's any way I can help debug this. |
I am getting the same issue, rename and show references does not work on .fsx. Repro:
let x = 4.0
printfn "%A" x
System info: Log: [15:58:48.090 INF] [LSP] TextDocumentHover Request: {"TextDocument": {"Uri": "file:///c%3A/Users/nicho/Dropbox/Research/test2/test.fsx", "$type": "TextDocumentIdentifier"}, "Position": {"Line": 0, "Character": 3, "$type": "Position"}, "$type": "TextDocumentPositionParams"} Server trace:
@baronfel , if there's anything else that I can provide to help debug, let me know. I tried rolling back the install as far as 5.0.3 to see if I could track where it's breaking. |
I have the same issue. Renaming only works inside a function. |
Would it be possible to reopen this issue? I tried deleting If there's any data I could provide you with, just let me know, and I'll add it here. |
I'll re-open this since it is trivially reproducible with @nhirschey's steps with the latest Ionide. Symbol highlighting does work - the editor can pick up that But it also took a little time, with the logs indicating several failures before that was working. Rename and find refs do not work, though. |
After updating to Ionide version 5.5.2 I tried again to rename a function name in a
Could this be helpful in solving the issue? Being able to rename function names is such a godsend, and I'd love to have this features available in If you need any additional information, just let me know. EDIT:
|
@bytesource On 5.5.2, stable (not insiders) vscode, I am able to rename and find all references successfully given the repro of the problem in my comment earlier in the thread. I can switch back and forth between renaming the variable x and y. One time it did not work, but then I saved the file and it started working again. Version: 1.55.2 (user setup) |
@nhirschey, I tried what you did and... now it's working! It's fantastic! Has this issue been fixed recently or was it just a glitch (for lack of a better term) with my setup? |
@nhirschey I see, that's great. @baronfel, thanks a lot for bringing back autocomplete to |
Glad that things are ok for you all :) |
Rename is still broken for me with Ionide v5.5.5 and fsautocomplete v0.46.0. OS is Arch Linux. More specifically, the issue seems to happen when the type I'm trying to rename is used within an implementation of an interface for a class in a separate file. I've posted the smallest reproduction I've been able to come up with. RenameTest.fsproj <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>RenameTest</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="Domain.fs" />
<Compile Include="IFooPrinter.fs" />
<Compile Include="FooPrinter.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
</Project> Domain.fs namespace Domain
type Foo = {
A: int
B: string
} IFooPrinter.fs namespace Services
open Domain
type IFooPrinter =
abstract PrintFoo: foo: Foo -> unit FooPrinter.fs namespace Services
open Domain
type FooPrinter() =
interface IFooPrinter with
member this.PrintFoo(foo: Foo) =
printfn $"A = %i{foo.A}, B = %s{foo.B}" Program.fs open Domain
open Services
[<EntryPoint>]
let main argv =
let foo = {
A = 1
B = "2"
}
let fooPrinter = FooPrinter() :> IFooPrinter
fooPrinter.PrintFoo(foo)
0 Opening Unknown workspace edit change received:
{
"textDocument": {
"uri": "file:///home/jordan/src/RenameTest/IFooPrinter.fs"
},
"edits": [
{
"range": {
"start": {
"line": 5,
"character": 28
},
"end": {
"line": 5,
"character": 31
}
},
"newText": "Bar"
}
]
} Sometimes after editing and saving |
@LiteracyFanatic you say
This makes me wonder, when renaming does not work for you, is type checking working? I have found that renaming will not work and I get errors like the one you provide if type checking is broken as described in this issue #1500 (I give a script issue, but booksbaum gives a project example). However as long as the file is properly getting typechecked then renaming is fine. Do the workarounds described in that issue to bring back type-checking cause rename to start working again for you? Specifically, closing the files, closing the folder, then reopening? |
Good question. While I do run into the issue you linked at times as well, I can reproduce the behavior related to renaming while type checking is working fine for me i.e. line lenses are displayed and I can hover over values to see their type information displayed. It's just the rename command which is failing. Unfortunately, I have yet to find a consistent way to fix it. I've messed around with editing and saving the file, clearing ionide's cache, and opening and closing vs code. Frustratingly, all I can say is that it will sometimes start working and other times will not. It never works when freshly cloning the example I posted though. |
@LiteracyFanatic see this gif. I get line lenses and hover values even though the file is not getting type checked (note the integer in the string list). And rename will also fail. But then if I do I always get this rename error when my file is not being type-checked. I have not gotten this rename error while the file is properly type-checked. For me, the consistent fix is to close all files so that nothing is open in the editor, close the project folder, then reopen things. Booksbaum has some other ways for projects such as the |
@nhirschey I better understand what you mean now. I tried adding a list similar to yours and it properly typed checked and underlined the integer with red squiggles. Renaming I'm fairly certain the issue I'm experiencing is related to interface definitions specifically. I have a medium sized ASP.NET Core project that seemingly randomly refuses to let me rename things. Values inside a function work fine, but types are hit and miss. Even with two records defined in the same file, one will rename fine and the other won't. My attempts to reproduce in a test project kept failing. Finally I realized that all of the types that wouldn't rename appeared in a class implementing an interface I was injecting into the dependency container. Any types which where only being used in functions or class members that didn't belong to an interface would rename fine. Unfortunately that means 90% of my domain and data model types won't rename. |
I still run into this regularly and it's quite easy to reproduce as well.
Not sure if it helps at all, but the start/end line characters don't line up with any source code. That is to say, the character runs past the length of the line. The start/end ranges also seem in the nearby vicinity of something that should get renamed (1 line+-) but are off. |
Unfortunately, the issue is back for me, too. |
Could maybe someone reopen this ? |
I am brand new to F# and created a brand new SAFE application and rename(F2) functionality is not working |
sorry about that! we still haven't released the fix in Ionide yet. we're working on it, though! |
7.0.0 is now released. |
Wohoo!
Krzysztof Cieślak ***@***.***> schrieb am So., 24. Juli 2022,
00:11:
… Closed #1265 <#1265>
as completed.
—
Reply to this email directly, view it on GitHub
<#1265 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOANFNML6PCILN5FQDZQ3VVRU2LANCNFSM4JVO6SHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
Describe the bug
F2/rename of a function name or type name simply does not work. (It does work on function parameters.)
To Reproduce
Steps to reproduce the behaviour:
dotnet new console -lang F# -o RenameError
cd RenameError
code .
main
functionExpected behaviour
The function name is renamed to the different name.
Environment (please complete the following information):
Additional context
With verbose logging set to
true
in settings I get the following in the F# output:Let me know if there are other logging or debugging settings I can tweak.
The text was updated successfully, but these errors were encountered: