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

Fix core syntax, enhance extension scope #754

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

grabthar
Copy link

Description

  • Fix all core syntax from non available lua api.
    The motivation is to simplify the coding process for core users, by providing exactly what core api offer to user.
    I don't think Sumneko would directly support Core syntax/API, so I did copy and comment non available part.
  • Fix core project scope, other lua projects are now respected, user settings too.

Fixes #(issue)

Type of change

  • Fix all core syntax from non available lua api, by removing sumneko partially/unsuported libs (builtins).
  • Add a command to switch from/to user/core builtins.
    Any time the user change the lua builtins settings it is persisted but the user could also switch to core builtins settings with the command.
  • Settings for a core project now only affects the current project (workspace). It no more affect your (user settings) other lua projects would run fine and not polluted by core syntax.
  • vscode-core extension is now only started from core project, no more for all lua files (detect meta.pbt file).

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change which adds functionality)
  • Refactor (improves existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  • Performed the "Extension test" configuration
  • Ran in debug / test configuration/reload
  • Packaged with vsce and tested many configuration/reload/intellisense

Checklist

  • My code follows the style guidelines of this project

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation

  • My changes generate no new warnings

  • I have made changes that conform to the documentation

Todo

Lua globals are still referenced as globals across different scripts. I don't know how to fix the split of _G/_ENV.
Globals in core should be only relative to _ENV.

Fix all core syntax from non available lua api.
Removing sumneko partially/unsuported libs (builtins).
Add a command to switch from/to user/core builtins.
Settings for a core project now only affects the current project (workspace) no more affect your (user settings) other lua projects.
vscode-core extension now only started from core project not for all lua files (detect meta.pbt file)
@StanzillaManticore
Copy link
Contributor

Hey there, thanks for the PR!

If possible, could you make one PR per feature? I do like some of them but not all but might be convinced otherwise.

vscode-core extension is now only started from core project, no more for all lua files (detect meta.pbt file).

Did you test if this works if a user just opens a single script file from Core itself? As in, no workspace?

Fix all core syntax from non available lua api, by removing sumneko partially/unsuported libs (builtins).

Could you clarify the reasons for this and what it fixes?

@grabthar
Copy link
Author

Hey there, thanks for the PR!

If possible, could you make one PR per feature? I do like some of them but not all but might be convinced otherwise.

Hello, i'm not a git expert + i'm lazy, and sorry for not having made several commits. When i do i tend to do incomplete task and revert many times my work.

vscode-core extension is now only started from core project, no more for all lua files (detect meta.pbt file).

Did you test if this works if a user just opens a single script file from Core itself? As in, no workspace?

Yes for a single file this wouldn't work. However when you have a workspace with this extension enabled activated, if you open an external lua file you would have the "core" syntax because the file opened in this workspace.
It search in the workspace if it could find the file, this would also work for workspace that contain many core project. Side note opening a single file isn't great, users won't have references to other scripts content, you may recommend users to open their project folder? Also for myself I hide .pbt from my workspace in settings.json:

     "files.exclude": {
         "**/Scripts/*.pbt": true
     },

This is cleaner, but this is a personnal preference. It could be great to have a representation of the core virtuals folders in vscode to have code separation like core does. This might not be easy to do, it would require parsing/gen pbt, and virtual folders in vscode. Some extension seems to do virtual folder but having that from vscode-core would be nice.

Fix all core syntax from non available lua api, by removing sumneko partially/unsuported libs (builtins).

Could you clarify the reasons for this and what it fixes?

The fixed syntax is for lua builtins intellisense. Example the string lib has a dump function wich is accessible for sumneko with those change it could no more be accessed, other example for os lib:
before:
image
after:
image

This does only affect:
https://docs.coregames.com/fr/api/#built-in-lua-functions
This is not related to Core types
#742

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

Successfully merging this pull request may close these issues.

2 participants