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

support multi tlconfig.lua #43

Closed
virusdefender opened this issue Jul 23, 2021 · 1 comment
Closed

support multi tlconfig.lua #43

virusdefender opened this issue Jul 23, 2021 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@virusdefender
Copy link

Now the vscode-teal plugin will run tl command in the root of the workspace, so tl will use tlconfig.lua in this dir, it's ok if the workspace only contains one teal project, you can add the source dir to tlconfig.lua like project_name/src/.

However, sometimes we need to develop some independent projects in one workspace, so the include_dir may conflict if different projects contains the same file name. Demo: https://github.com/virusdefender/tlproject

If you want to edit project2/main.tl, you need to change include_dir to project2, if you want to edit project1/main.tl, you need to change include_dir to project1, or wrong functions.tl will be loaded, it's very inconvenient.

It seems tl supports searching tlconfig.lua outside current dir (https://github.com/teal-language/tl/blob/15bb48baa3a1055e6ae664ccb530665b49c7e02c/tl#L892), if vscode-teal run tl command with cwd = dirname(file_to_check_or_get_types), tl will use tlconfig.lua in the root of project instead of the root worksapce, so the problem in demo project can be avoided.

@pdesaulniers pdesaulniers added the enhancement New feature or request label Jul 23, 2021
@pdesaulniers pdesaulniers added this to the v0.8.0 milestone Jul 23, 2021
@pdesaulniers
Copy link
Member

pdesaulniers commented Jul 23, 2021

Should be fixed by 717a482.

The behavior is now the following:

  • If tlconfig.luacan be found in the parent directories of the source file, the extension will run tl with cwd = <directory of the nearest tlconfig.lua file>.
  • Otherwise, the extension will run tl at the root of the workspace.

This seems to fix the problem in your demo.

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

No branches or pull requests

2 participants