Skip to content
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 symbol wierd behaviour #448

Closed
kiroukou opened this issue Jul 1, 2020 · 22 comments
Closed

Rename symbol wierd behaviour #448

kiroukou opened this issue Jul 1, 2020 · 22 comments

Comments

@kiroukou
Copy link

kiroukou commented Jul 1, 2020

See video for detailed behaviour :
https://slack-files.com/TFQ2HEP8R-F016CF632GK-fab56fb779

System:
Haxe 4.0.3 & Haxe 4.1.2

VsCode with
Haxe Extension Pack 1.3.0

Any idea of what is creating that behaviour? in addition to that, the symbol inside the blocks aren't renammed the same way.
thanks

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2020

No, I've never seen that, but that's pretty funny. 😄 Any idea how to reproduce that / does that happen consistently?

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020

It happens for 3 of our devs, different machines. consistently.
Really no idea when it appeared, but from what they told me, that feature wasn't hardly working before as well. Just, less funny.

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2020

In any case, not much to be done if it can't be reproduced - seems to work fine on my end.

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020

hum...
if you can't reproduce, let me check differently then. I'll disable other extensions and share with you the haxe configuration we use in case that could be related.

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020

Ok so I tried on an other project, disabling most of the other extensions.

Here is the behaviour in video :
https://streamable.com/3zlwb9

what you can see here :

  • first type, renaming didn't work at all
  • redo the renaming, it does rename the variable but not the references
  • IT DOES MODIFY some variable which are not related !

Any idea of some tech stuff I can look at ?
Any settings you could recommend ? (maybe share a launch.json / task.json / settings.json setup that does work for you )

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2020

I don't think there's any settings which would be relevant here...

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020

ahah. Well, that still could be interessting for me to see someone else settings.

Otherwise, do you have something in mind that could explain that behaviour ? (which is consistent here for several people)

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2020

Nope, no idea. 😄 Does that happen even in a hello world project?

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020

not better: https://streamable.com/ax944k

Are you sure it does work for you ? ^^
but yeah, is that a visual studio code feature integration into the extension or is that something specific the completion server can supply (in this case, how can I debug that) ?

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2020

0uIu4oWXxK

The Haxe server is not involved here actually.

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020

wow. Alright then.
Need to make an haxe version upgrade I guess... I cant see anything else.

@Gama11
Copy link
Member

Gama11 commented Jul 1, 2020

You're using latest vshaxe? You said Haxe Extension Pack 1.3.0, but the version of that is pretty irrelevant.

@kiroukou
Copy link
Author

kiroukou commented Jul 1, 2020 via email

@ee-ij
Copy link

ee-ij commented Jul 2, 2020

Hi!
I am running into this issue with Haxe 4.1.2, vshaxe 2.21.0. I have disabled all other extensions to avoid any interference.

Here's a self-contained example: Hello.zip

class Hello {
    function new() {}

    function foo() {
        for (i in 0...10) {
            trace(i);
        }
    }

    static function main() {
        new Hello().foo();
    }
}

After placing the caret on the first "foo" (function declaration) and pressing F2 to rename the symbol, it seems all letters from the original symbol must occur in the new name for anything to happen. And even then, the renaming acts strangely. Here are some examples of what happens for me:

  • Renaming foo to bar fails with "Rename failed to apply edits".
  • Renaming foo to fo fails with "Rename failed to apply edits".
  • Renaming foo to foobar: Getting foobarbarbar instead. The function call in main doesn't get renamed.
  • Renaming foo to f_o_o: Getting f___o___o instead. The function call in main is still unchanged.

Similarly, renaming i in the function body fails if the new name does not contain the letter i. E.g. renaming i to hi "works" but yields hhhi, and i within the loop body isn't renamed.

Please let me know if there's anything I can do to help troubleshoot this further. Thank you!

@Gama11
Copy link
Member

Gama11 commented Jul 2, 2020

@ee-ij There's no support for renaming fields (#188). You should see this message when trying to rename foo:

image

I can't reproduce the problems with renaming i either.

HMxR90DolF

@kiroukou
Copy link
Author

kiroukou commented Jul 2, 2020 via email

@Gama11
Copy link
Member

Gama11 commented Jul 2, 2020

I used @ee-ij's self-contained example project there with vshaxe 2.21.0. ¯\_(ツ)_/¯

@kiroukou
Copy link
Author

kiroukou commented Jul 3, 2020

Would you mind to share thhe list of your extensions and versions so we can try to reproduice your environnement?

Are you on Windows ?
Thx

@AlexHaxe
Copy link
Member

AlexHaxe commented Jul 3, 2020

I just tried it on Linux and I see Rename failed to apply edits as well.
When using preview I get:
refactor_foo
and
refactor_i
So apparently there are three edits all for the same location. If I deselect two and apply, then it works for just that one occurence, it doesn't change other places.

Developer console shows an error and a stacktrace:

notificationsAlerts.ts:40 Rename failed to apply edits
    onDidChangeNotification @ notificationsAlerts.ts:40
    (anonymous) @ notificationsAlerts.ts:26
    fire @ event.ts:587
    addNotification @ notifications.ts:207
    error @ notificationService.ts:59
    (anonymous) @ rename.ts:238
    Promise.catch (async)
    (anonymous) @ rename.ts:237
    processTicksAndRejections @ internal/process/task_queues.js:85
    Promise.then (async)
    run @ rename.ts:217
    async function (async)
    run @ rename.ts:173
    run @ rename.ts:306
    runEditorCommand @ editorExtensions.ts:259
    (anonymous) @ editorExtensions.ts:191
    invokeFunction @ instantiationService.ts:61
    invokeWithinContext @ codeEditorWidget.ts:360
    runCommand @ editorExtensions.ts:184
    runCommand @ rename.ts:300
    handler @ editorExtensions.ts:101
    invokeFunction @ instantiationService.ts:61
    _tryExecuteCommand @ commandService.ts:84
    (anonymous) @ commandService.ts:73
    Promise.then (async)
    executeCommand @ commandService.ts:73
    _doDispatch @ abstractKeybindingService.ts:200
    _dispatch @ abstractKeybindingService.ts:159
    (anonymous) @ keybindingService.ts:251
log.ts:197   ERR Error: Overlapping ranges are not allowed!
    at c.applyEdits (pieceTreeTextBuffer.ts:297)
    at e._doApplyEdits (textModel.ts:1376)
    at e.applyEdits (textModel.ts:1366)
    at pushEditOperation (editStack.ts:402)
    at e._pushEditOperations (textModel.ts:1314)
    at e.pushEditOperations (textModel.ts:1223)
    at executeEdits (cursor.ts:563)
    at viewModelImpl.ts:926
    at y._withViewEventsCollector (viewModelImpl.ts:1004)
    at y._executeCursorEdit (viewModelImpl.ts:923)
    at y.executeEdits (viewModelImpl.ts:926)
    at executeEdits (codeEditorWidget.ts:1131)
    at D.apply (bulkEditService.ts:117)
    at e.apply (bulkEditService.ts:228)
    at e._performTextEdits (bulkEditService.ts:379)
    at async e.perform (bulkEditService.ts:323)

@kiroukou
Copy link
Author

kiroukou commented Jul 3, 2020

Thanks @AlexHaxe for the test and confirmation of the issue.
If there's an overlap, that would explain the first video I shared.

What sounds strange, is the fact @Gama11 cannot reproduce it. We did some test on a fresh VM, standalone project, windows and linux, and latest official haxe and plugin + vscode editor, and we have the error easily reproductible.

@Gama11
Copy link
Member

Gama11 commented Jul 3, 2020

Looks like this only reproduces with vshaxe compiled in release mode (rather than debug which I was using before) for some reason... 🤦‍♂️

@Gama11
Copy link
Member

Gama11 commented Jul 3, 2020

Seems that minification with uglify-es breaks something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants