tommasongr
(Tommaso Negri)
May 21, 2023, 12:29pm
1
Hi there!
I had a look at the new Format Document command of v11 and I experienced a code duplication with two different language servers.
Considering a file with this content:
class MeController < ApplicationController
def show
puts "ciao"
end
end
I would expect the following result after running the command:
class MeController < ApplicationController
def show
puts "ciao"
end
end
Instead I got this:
class MeController < ApplicationController
def show
puts "ciao"
end
end
class MeController < ApplicationController
def show
puts "ciao"
end
end
If it can help this is the response of the formatting request:
[{"newText":"class MeController < ApplicationController\n def show\n puts \"ciao\"\n end\nend\n","range":{"start":{"character":0,"line":0},"end":{"line":5,"character":0}}}]
Since I can’t configure the feature in any way I consider this a Nova issue. If I can help debugging this in any way let me know.
Thanks!
kris
May 22, 2023, 9:17am
2
I’m seeing this behaviour as well with my extension; the textDocument/formatting response of my LSP server is handled correctly in VSC, but in Nova the formatted text is inserted into the document instead of replacing the current contents.
1 Like
logan
(Logan)
May 22, 2023, 4:32pm
3
Thank you for the bug report. We will investigate.
1 Like
robb-j
(Rob Anderson)
November 8, 2023, 10:41am
4
Hi, this still seems to be a bug as of Nova 11.6. I’m not sure what version we were on when this was reported.
mrsdizzie
(Isla W)
December 25, 2023, 5:34pm
5
I’ve also seen this issue when working with a LSP. The LSP seems to send a reasonable response:
Received JSON-RPC response: number(49) textDocument/formatting
{
"jsonrpc" : "2.0",
"result" : [
{
"range" : {
"start" : {
"character" : 0,
"line" : 0
},
"end" : {
"character" : 0,
"line" : 279
}
},
"newText" : "xxx"
}
],
"id" : 49
}
But I end up with he entire document duplicated at the end