calva

zihao 2025-04-05T04:37:00.610189Z

not sure if this is a calva problem. I am using windsurf on windows, whenever Cascade modifies the file. there will be some red marker, and paredit features like expand selection will highlight the wrong position. it will fix after restarting windsurf, close file and open again won't fix. any pointer how to debug this problem?

pez 2025-04-05T04:53:06.249859Z

Ouch! What is Windsurf?

zihao 2025-04-05T06:11:21.942519Z

an ai editor like cursor, also based on vscode

pez 2025-04-05T06:35:12.371169Z

Thanks. And what is Cascade?

zihao 2025-04-05T07:17:44.531919Z

Cascade is the name of the agent in Windsurf? it can read and modify file on user's behalf

zihao 2025-04-05T07:18:31.545279Z

only windows has this problem, wsl also works fine.

pez 2025-04-05T08:06:44.314579Z

Only Windows, huh? Then I have a theory. Line ending mismatch. If the file has Unix lin endings and then Cascade is inserting Windows line endings (or vice versa), the characters in the file will be offset by one for each line. This will throw Calva’s structural editor out of whack. There may be an issue on Windsurf about line endings. Or there may be settings for it. VS Code can update line endings for the file too, and it also has some settings for it, so it may be able to control from there. In any case, Calva will not work well in a file where the line endings are not consistent with the OS, and certainly not if there are inconsistencies within the file.

👀 1
chromalchemy 2025-04-05T16:39:11.205599Z

I am using Windsurf on OSX with Calva and haven’t noticed this problem. PS. It was really cool to be able to try Cursor and Windsurf and take Calva with me!

zihao 2025-04-06T01:14:17.612039Z

I use dos2unix to convert linebreaks to LF before letting AI modify the file, and there are no more errors.

zihao 2025-04-06T01:18:16.194589Z

I guess it is because of the linebreak. I have switch to wsl

pez 2025-04-06T06:51:42.536269Z

Cool. Thanks for reporting, and for updating back. 🙏