Vscode-tads3tools extension alpha release 0.6.1

Can’t wait to try it out! Thanks a ton!

1 Like

Likewise, many thanks for all the bug reporting!

Just as a little side question. Does anyone have a good advice on a dark color theme for VS Code that works fine with TADS3?

Jens

I use the built-in Dark+ theme and Source Code Pro typeface for editing code. I don’t have any problems with the combination and TADS 3.

– Jim

1 Like

New release: version vscode-tads3tools 0.5.0-alpha

Highlights:

  • Not sure how many people are still using Tads2 but the extension now supports that language as well! It has almost all the features that users of Tads3 has, e.g the outliner, the visual map, goto-definitions, workspace symbols locator, game runner etc.

  • The snippets have been overall improved. Snippets are now added differently depending on library used. Different snippets will appear depending on using Tads3 adv3/adv3Lite or Tads2.

Plus additional fixes and improvements, see the change log for details:
vscode-tads3tools/CHANGELOG.md at main · toerob/vscode-tads3tools · GitHub

5 Likes

New release: vscode-tads3tools 0.6.0-alpha!

New features:

  • Signature help provider
  • Implementation provider
  • References provider
  • Document formatter provider
  • Document range formatter provider,
  • Links and completions are now available for the tads3 makefile.
  • Added a view for game scripts in the explorer pane.

See the changelog for details:

3 Likes

Thank you very much. With VScode, your tool works well across the common platforms.

Thank you!

Actually I think I messed up this time. I did some last modifications on linux that didn’t quite worked out on windows. I’ll soon release a patch for this. Meanwhile (if having trouble on windows), try setting tads3.enableScriptFiles to false. There’s a problem with parsing a path there that’s only affecting windows os:es.

2 Likes

I did notice an issue on my Win11 laptop. I will try this change.

Thank you

I just did a patch release (v0.6.1-alpha). It should work better now.

2 Likes

(Apologies that this has almost certainly been covered elsewhere, but I’ve only half been paying attention:)

I get that this is targeted mainly at non-Windows, but as a Windows user: are there definite advantages to using VScode + these tools over the Workbench IDE in Windows? If so, what, in a nutshell, are they? In layman’s terms please; I’m not a software engineer…

Thanks!

The tads3 workbench builds on a dated editor framework (scintilla). It’s a nice environment but lacks modern code assisting. It’s big advantage though is that it has a debugger. (This is not yet implemented in my extension.)

Otherwise the vscode extension provides a lot of benefits even for the windows user. You can, to name a few of them, hover on symbols to get documentation, ctrl-click on almost any symbol to quickly navigate to the definition. Use snippets to speed up the typing. Use the map editor that show your game “from above”… there’s a lot more but that’s covered in the Readme on the repository. There’s also movies there to show the features.

I would recommend you to try it out.

2 Likes

Many thanks - I’ll have a proper look at it.

With the lack of a debugger: that means that if there’s an error, the game will refuse to compile but it won’t flag up the exact part of the source code where the error occurs?

Not quite. A debugger halts the program execution at any specified “breakpoint” (usually a red dot that you set manually in the left margin of the row you are interested in, in the editor), and then lets you step through the instructions one by one (usually row by row) in your own pace to carefully inspect values as they change. You can at any time resume the execution and then the debugger will run till it finds another breakpoint or the program exits.

The error reporting you are talking about is what the compiler gathers and that is covered in the vscode extension.

2 Likes

Thank you for the update.

1 Like

You’ve convinced me to give it a try. I’ve used the debugger a few times, but my experience with it has been that the library goes through so very, very many steps in preparing to print a message to the screen that setting a breakpoint and stepping through is almost a useless exercise, and wearying too.

I don’t understand how to set up the file structure for my project so as to get it to compile. I want to create a special testing environment so as to have a look at this. I’ve dropped all of my project files into a separate folder, along with the .t3m and the folder containing the adv3Lite library, but on saving a source file I get “Parsing all files failed via makefile PD_2017.t3m failed: No files to parse. Aborting operation.”

The makefile is in the same folder as the source files, and all of its -source items are exactly what they were before. I find no folder corresponding to

-lib system

however. There isn’t a folder called lib in the folder I’ve been using all along for my project, so I don’t know how the makefile is referencing it. It’s in Program Files (x86) / TADS 3, and that’s where it has always been, so possibly Workbench knows where to look for it but VS Code doesn’t. That would be my initial guess, anyhow.

I’m liking what I see in the VS Code editor! I just need to understand how to get my project to compile.

Okay, I’ve located the Feature Contributions page in the vscode-tads3tools area. It has settings for things like tads3/lib and tads3/include. But those data fields seem to be read-only. I don’t see how to change anything there, and I don’t know where else I would go to change it.

And now I’ve edited these settings in the Workspace area – and nothing has changed. There’s still no compiling happening.

The easiest way to troubleshoot this is to compile the project with the command line.
So just open up a terminal, cd to your project folder and type:

 "t3make -f PD_2017.t3m"

(or whatever your Makefile.t3m is callled)

I believe you might be right in that the library path “lib” isn’t reachable other than within tads3 workbench.

On my computer I have set up a global environment variable like:

TADS3_HOME=C:\Program Files\TADS3

and then appended the following to the global %PATH% environment variable:

PATH=%TADS3_HOME%;%TADS3_HOME%\lib;%TADS3_HOME%\include

This way C:\Program Files\TADS3\lib\system.tl" can be referenced directly as “-lib system”

In case you don’t want to set up this as global environment variables you can also set them up in the project’s makefile with the compiler switches “-FL” (for libraries) respectively “-FI” (for include headers).

For example:

-D LANGUAGE=english
-Fy obj
-Fo obj
-o game.t3
-FL "C:/Program Files (x86)/TADS3/lib"
-FI "C:/Program Files (x86)/TADS3/include"
-we
-v
-d

##sources
-lib system
-lib adv3Lite/adv3Lite
-source game.t

-res
GameInfo.txt

The variables you set in the extension reminds me that they must be leftover settings not used anymore. I’ve just forgotten to remove them. As a general concept the extension relies almost entirely on the project’s makefile. It just needs to know where to find the compiler “t3make.exe” and possibly the interpreter “t3run.exe” or “frob”).


In case you didn’t already try it you can get template project easily set up by first create a folder for a project on your hard drive, then choose “open folder” in vscode’s file menu and select that folder to open it up in the editor, press F1 while in the editor and type
“Tads3 command: Create a new Tads3 template project”, select the folder you are in and what library to use “adv3/adv3Lite”, done!

The only possible modification thereafter is the -FL and -FI paths (in case you don’t choose the global env variant)

1 Like

I opened Command Prompt, changed to the directory where I’ve copied all of my source code files, and entered the command exactly as you’ve shown it. I get this output:

‘t3make’ is not recognized as an internal or external command, openable program or batch file.

I use my computer every day, and in some ways I’m certainly a sophisticated user. But I’m not a real programmer, and I’m not an MS-DOS power user. What concerns me is that if this level of user hacking is required, it’s not going to help the average IF author. By now I don’t even remember what it was like to download and install Workbench, but I’m pretty sure it just worked. No environment path variables to set, nothing like that.

I would have no idea how to reach that state of nirvana with a VS Code template, so I can’t offer any suggestions.

I would offer one modest suggestion, however, based on your description of how the system works. I think it’s probably a bad idea to have compilation occur automatically each time a source code file is saved. I quite often work in two or even three source code files at once – and I’m also nervous about losing work in a power outage. So if I need to stand up for a minute for some reason, I will routinely save whatever file I’m working on, in whatever state it happens to be. It may be totally not something the compiler could ever deal with, and I know that. I don’t need to read a hundred error messages. What I would prefer is to have VS Code wait to compile the game until I tell it to.

Dilemma.

On one hand the process of compiling and installing frobtads (which will require a lot from the user in terms of experience), t3make will usually be found globally in the terminal since it is copied into a global path. (This is a more or less convention on *nix systems.)

On the other hand after a windows installment t3make.exe is only reachable from within the tads workbench universe… :person_shrugging:

I wouldn’t call setting global environment variables hacking. It’s pretty much what is required when installing a programming language and a rather standard thing to do when so required (which happens a lot). There are a plethora of guides on how to do this online.

However, I still think this is a valuable perspective and I will attempt to add an automatic scan of the t3make.exe program and/or its library paths in case t3make is not found in the extension.

About the suggestion to not automatically compile: adding a setting not to gather errors on save, yes. But I would default it to keep the current behavior.

In my experience as a programmer it’s better to get feedback continuously than to have a huge mess when it’s time to compile.

It’s maybe different from an author’s perspective, since there you’d want to concentrate on the story and not technicalities that might interfere with the flow. But an IF author is kind of stuck in between of two contradicting principles. Those of the author, and those of the programmer. Therefore it will be a user choice to toggle the behavior since everyone’s process is different.

“To Write Is Human. To Edit is Divine." - Stephen King

1 Like