rolandostar / tabletopsimulator-lua-vscode

Extension for VSCode to make writing Lua scripts for Tabletop Simulator easier.
Other
85 stars 16 forks source link

Get/Send LUA scripts to/from workspace folder #20

Open snebjorn opened 3 years ago

snebjorn commented 3 years ago

I'd like to fetch the scripts into my source control folder. Instead of always writing to

~/AppData/Local/Temp/TabletopSimulator/Tabletop Simulator Lua

Then I'd like to be able to configure it to

~/Repos/MyProject/src

Ideally this would be a setting we could put in .vscode/settings.json

greeze commented 3 years ago

This should currently be possible by opening your code directories in your VSCode workspace and using relative paths in your require. Check out the nested file feature to see if that provides what you're asking. This is working for me without adding any paths at all to the settings. Just adding my code directory to my project workspace was enough to get that working.

I'm not sure how it works internally, but it appears to be working as though all top-level directories in my project workspace are kind of treated as a single top-level directory. So if my workspace looks like this:

VSCode Project Workspace
+-- Dir_01
|   +-- SubDir_01
|       +-- file_01.lua
+-- Dir_02
|   +-- SubDir_02
|       +-- file_02.lua

Then I can require with relative paths, treating Dir_01 and Dir_02 as a single root directory and therefore leaving them out of the path. For example, I can require file_01.lua into file_02.lua like this:

file_02.lua:

require('SubDir_01/file_01.lua')

It's weird, but it works for me, anyway.