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

IntelliSensedon't replace the whole filed when used in the middle #7817

Open
MaxFalcone opened this issue Aug 7, 2024 · 2 comments
Open

Comments

@MaxFalcone
Copy link

1. Describe the bug
image
Lets say I have a piece of code and the field was renamed elsewhere. Now I want to change reference to the new name. I set cursor in the middle of the field and press Ctrl+Space, IntelliSense kicks-in and proposes correct new name of the field.

When I hit Enter new field name is inserted just in the middle of the line wrecking formating. I have to delete the rest of the old field name manually.
image

2. To Reproduce
See description.

  1. Create a field
  2. Referece this field in assignment or validate statement.
  3. Rename field without using Refactoring tools. As if the field is in another module that you have no control over.
  4. Try fixing your code using IntelliSense.

Change from

VATPostingSetup.Get(Vendor."VAT Bus. Posting Group", Vendor."VAT Agent Prod. Posting Group");

To (AWK is a company suffix)

VATPostingSetup.Get(Vendor."VAT Bus. Posting Group", Vendor."VAT Agent Prod PostingGroupAWK");

3. Expected behavior
When I hit Enter to accept IntelliSens proposal whole field name string should be changed from "VAT Agent Prod. Posting Group" to "VAT Agent Prod PostingGroupAWK" without any leftowers.

4. Actual behavior
Rest of the old field name that was to the righ of the cursor is left hanging and must be deleted manually.

5. Versions:

  • AL Language: v13.1.1065068
  • Visual Studio Code:
    Version: 1.92.0 (user setup)
    Commit: b1c0a14de1414fcdaa400695b4db1c0799bc3124
    Date: 2024-07-31T23:26:45.634Z
    Electron: 30.1.2
    ElectronBuildId: 9870757
    Chromium: 124.0.6367.243
    Node.js: 20.14.0
    V8: 12.4.254.20-electron.0
    OS: Windows_NT x64 10.0.22631
  • Business Central: 24.0
  • List of Visual Studio Code extensions that you have installed:
@dannoe
Copy link

dannoe commented Aug 14, 2024

You can just set "editor.suggest.insertMode": "replace" in your vscode settings.

Edit: This does not work if the replaced field name contains a dot. (.)
Edit2: If the cursor is after the dot it still works.

@MaxFalcone
Copy link
Author

Thanks a lot! It does partially work.
The fact that it doesn't work if field name hase dot in it is again, I believe, because of strange language tokens parsing by AL extension that was causing other issue(#7744) I raised. But it was rejected. I wonder if thes problems have common cause.

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

3 participants