Jump to content

Photo

VS Code plugin for ZScript


  • Please log in to reply
8 replies to this topic

#1 connor.clark

connor.clark

    Junior

  • ZC Developers

Posted 27 July 2023 - 08:17 PM

There is now a plugin for the VS Code editor: https://marketplace....amcl.zquest-lsp

Basic features it supports currently:

* Underline warnings/errors from the compiler, directly in the editor

* Syntax highlighting

* (very experimental) code formatting, if you have clang-format installed.

 

Here is an example: https://imgur.com/Rz4fAa3

 

 

In the future, we'll possibly add things like contextual autocompletion, and shortcuts for Test Mode / launching ZQ.


  • Anthus, Twilight Knight, Alucard648 and 3 others like this

#2 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 28 July 2023 - 08:44 AM

Amazing! I'll try it out soon

This was still on my TODO list, but you beat me to the punch :-)



#3 Matthew

Matthew

  • Administrators
  • Pronouns:He / Him
  • Location:Ohio

Posted 28 July 2023 - 03:41 PM

This is wonderful to see. Now, we just need to train GitHub copilot on the entire script database and start AI-generating scripting away.



#4 connor.clark

connor.clark

    Junior

  • ZC Developers

Posted 07 April 2024 - 09:26 PM

This just got a big update for 3.0 ZC: https://zquestclassi...-code-extension

 

I'll be implementing more of VS Code's language server features. If anyone would enjoy a particular feature, let me know: https://code.visuals...eatures-listing

 

Currently I'm working on getting all internal functions (global functions, Game->/Screen->/bitmap-> etc. methods/properties) to provide a documentation comment when hovering over them (currently only have that working for stuff you define in a script yourself).


  • Jambu likes this

#5 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 01 May 2024 - 11:34 AM

Hey Connor thought I would check this out and I am curious how do I prevent VSCode from marking functions from the std library as errors.



#6 Emily

Emily

    Scripter / Dev

  • ZC Developers
  • Pronouns:She / Her

Posted 01 May 2024 - 02:51 PM

Hey Connor thought I would check this out and I am curious how do I prevent VSCode from marking functions from the std library as errors.

You need to set up the extension so it understands what files to look at. In the extension settings, there is a setting for `Default Include Files`. You'll want to make sure one of these is the `std.zh` file.

 

Additionally, if you have multiple script files of your own, they may mark *each other* as errors because they don't know about each other. This can be handled by having a "project entry point" file - a single file, that has nothing in it but #includes to your other files. If you then set THIS file as a `Default Include File`, it will know how to read all of your script files when checking for validity.


  • Jambu likes this

#7 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 01 May 2024 - 08:47 PM

You need to set up the extension so it understands what files to look at. In the extension settings, there is a setting for `Default Include Files`. You'll want to make sure one of these is the `std.zh` file.

 

Additionally, if you have multiple script files of your own, they may mark *each other* as errors because they don't know about each other. This can be handled by having a "project entry point" file - a single file, that has nothing in it but #includes to your other files. If you then set THIS file as a `Default Include File`, it will know how to read all of your script files when checking for validity.

Do you have an example. I have this...

iERkRhR.png

still throwing me errors.



#8 connor.clark

connor.clark

    Junior

  • ZC Developers

Posted 02 May 2024 - 01:48 PM

I recommend having an include statement at the top of every file that imports whatever the file uses directly. The reason is that the extension only considers each file separately (and anything it includes, recursively) when validating it.

Otherwise, adding all as default included as Emily said is the only other solution.

Your screenshot is not enough information to say anything more.

Currently I'm working on getting all internal functions (global functions, Game->/Screen->/bitmap-> etc. methods/properties) to provide a documentation comment when hovering over them (currently only have that working for stuff you define in a script yourself).

 

(3.0 only) This is implemented now.

 

You can hover over any of the internal functions or global variables to get a documentation comment as a tooltip (if present). You can also Ctrl/Cmd click on these internal symbols to open the relevant "bindings" file, which shows you all the other methods available for that specific internal class.



#9 Jambu

Jambu

    Doyen(ne)

  • Members
  • Pronouns:He / Him

Posted 02 May 2024 - 02:21 PM

I figured it out. I was adding it to the path not as an include file. silly me...




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users