Skip to content

Adding +=, -=, and others to nonstandardSymbol doesn't fix formatting for that file #1175

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
unbelievableflavour opened this issue May 27, 2022 · 12 comments
Assignees
Labels
feat/formatter Related to code formatter

Comments

@unbelievableflavour
Copy link

Describe the bug
When adding +=, -= and other symbols to Lua.runtime.nonstandardSymbol, errors are removed from the "Problems" tab, and compiling is possible again. But formatting the document doesn't work when foo += 1 is somewhere in the document.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a file
  2. add
local foo =               0
foo += 1
  1. Reformat the document
  2. Code stays like
local foo =               0
foo += 1

Expected behavior
Code should look like

local foo = 0
foo += 1

Environment:

  • OS: macOS
  • Client: VSCode
@sumneko sumneko added the feat/formatter Related to code formatter label May 27, 2022
@sumneko
Copy link
Collaborator

sumneko commented May 30, 2022

@CppCXY

@CppCXY
Copy link
Member

CppCXY commented May 30, 2022

Reformat nonstandard-symbols, you can't simply say what they are, and I also need to know their grammar features.
it's easy If only '/=' '-=' these are similar to the equal sign.

@unbelievableflavour
Copy link
Author

unbelievableflavour commented May 31, 2022

Could you rephrase that? I don't really know what you mean. This is my config file if that helps.

{
    "editor.formatOnSave": true,
    "Lua.runtime.version": "Lua 5.4",
    "Lua.diagnostics.disable": [
        "undefined-global",
        "lowercase-global"
    ],
    "Lua.diagnostics.globals": [
        "playdate",
        "import"
    ],
    "Lua.runtime.nonstandardSymbol": [
        "+=",
        "-=",
    ],
    "Lua.workspace.library": [
        "$PLAYDATE_SDK_PATH/CoreLibs"
    ],
    "Lua.workspace.preloadFileSize": 1000
}

@CppCXY
Copy link
Member

CppCXY commented May 31, 2022

This function is not implemented now, but if I want to implement it, a separate configuration may be required
for example, I need to know that ‘+=’ is similar to the ‘=’

@unbelievableflavour
Copy link
Author

unbelievableflavour commented May 31, 2022

If you mean you want to know what += means:

varName += 1 means varName = varName + 1
varName -= 1 means varName = varName - 1

Sorry if that's not what you meant.

@CppCXY
Copy link
Member

CppCXY commented May 31, 2022

Well, although you don't understand what I mean, I'm already working on it, just be patient

@CppCXY
Copy link
Member

CppCXY commented May 31, 2022

wait #1187 merge

@unbelievableflavour
Copy link
Author

This issue is marked as closed, though the issue persists for me. It still won't lint. Does the configuration need to be changed or anything?

@sumneko
Copy link
Collaborator

sumneko commented Jun 16, 2022

What do you mean of 'lint' instead of 'formatting'?

@unbelievableflavour
Copy link
Author

unbelievableflavour commented Jun 16, 2022

I meant formatting, sorry.
When I format my code I expect it to by aligned with other code. As soon as you use += in a line; that doesn't work anymore.

Screenshot 2022-06-16 at 08 47 09

Expected result:

Screenshot 2022-06-16 at 08 47 21

Actual result:
Screenshot 2022-06-16 at 08 47 27

@sumneko
Copy link
Collaborator

sumneko commented Jun 16, 2022

1

I did some tests and it seems works well

@unbelievableflavour
Copy link
Author

My bad! Retested and after resaving .vscode configs it seems to work again. Some issue on my end. Closing this again! Thanks for the help.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feat/formatter Related to code formatter
Projects
None yet
Development

No branches or pull requests

3 participants