Skip to content

Visual Studio Code nwscript syntax highlighting

For those that use Visual Studio Code (A very nice code editor that supports Windows, Linux, and MacOS) I grabbed the Sublime nwscript syntax highlighting and pushed a syntax extension you can add. I also pushed the code here and if anyone wants to contribute / add compiler commands etc. please do so. https://code.nwnx.io/Glorwinger/vscode-nwscript

Comments

  • GlorwingerGlorwinger Member Posts: 41
    For those of you who haven't tried it - Visual Studio Code != Visual Studio. Visual Studio Code is light weight (around 200 MB total) and is designed to be a fast code editor with some advanced features but not a full IDE.
  • TarotRedhandTarotRedhand Member Posts: 1,481
    For users of other programmer's text editors there is a similar package called "Fancy Colors - NWScript support in text editors". This provides highlighting for the following editors -

    ConTEXT
    Crimson Editor
    Notepad++
    Programmer's Notepad
    PSPad
    SciTE
    TextPad

    One thing to note is that this package, as it ships, is broken as far as Notepad++ is concerned. Fortunately it is very easily fixed. What happened is that a few months after Fancy Colours was released the people who look after npp changed the format of the data files used. To get it working again just do this -

    Download Fancy Colours and extract the package to a temporary folder. Open notepad++ as an administrator. Open the language menu item and scroll all the way to the bottom. Click on Define your language. This opens a dialogue. Click the import button and navigate to your temporary folder. Select the first xml file (ignore the ones in the subfolders) and load it. That's it you're done. Now you will have an option in languages right at the bottom marked nwscript.

    TR
  • raz651raz651 Member Posts: 175
    For those that want to take a look at this HippoEDIT editor. It is on the free givaway for today. It allows defined plugins as well has has a lot of predefined syntax codes to be used. It might be worth getting since it is free for today. https://www.giveawayoftheday.com/hippoedit-1-60-2/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+giveawayoftheday/feed+(Giveaway+of+the+Day)&utm_content=FeedBurner#
  • nivniv Member, Moderator, Developer Posts: 410
    @Glorwinger Do you have experience writing debugger shims for vscode? I briefly looked into it and it seems a fairly easy thing to do.
  • GlorwingerGlorwinger Member Posts: 41
    @niv I have not written anything beyond the syntax addition I pushed. I agree it looks rather easy and I want to add better services and compilation etc. but for now all I have is the syntax.
  • fot1fot1 Member Posts: 74
    @Glorwinger is it worth the hassle to edit scripts outside of toolset editor? How do you do?
  • GlorwingerGlorwinger Member Posts: 41
    @fot1 For me - and many others - yes... The external editors are much more powerful, the external script compilers are faster and more consistent as well as better errors in many cases. There are several ways to modify the scripts:
    • When the toolset open the module it unpacks everything into a temp folder - you can edit compile the resave the module
    • There are various module unpackers and packers that will extract the module
    Some module and PW developers use the unpacked module with a source code control system to manage changes and ensure things stay consistent.

    If you are interested in how to specifically I can provide more details if you have questions.
  • fot1fot1 Member Posts: 74
    edited January 2018
    @Glorwinger Thanks! I'll try to make it work tonight, and if I fail I'll ask you for some pointers :wink:
  • fot1fot1 Member Posts: 74
    @Glorwinger have you been successful using any compiler with beamdog's nwn? I can't make nwnnsscomp.exe to find neverwinter nights libs that he needs to compile. I'm a windows noob, so I don't even know how to get started, and can't find any content explaining how to use with EE. If you could make a post with pointers would be great! (probably worth a new post)
  • GlorwingerGlorwinger Member Posts: 41
    @fot1 I have not configured a compiler yet and this thread shows some of the challenges... https://forums.beamdog.com/discussion/67863/help-setting-up-external-script-compiler#latest . One main issue appears to be that the external script compilers rely on the script resources from the game and are currently 'pointing' at 1.69 not EE. I am looking at options and will post if I have success.
  • fot1fot1 Member Posts: 74
    @Glorwinger yeah, thanks! That was me that revived the thread actually :-)
  • SwitchuSwitchu Member Posts: 1
    *takes a shovel*
    @Glorwinger Could You please rehost the source code? I'd very much like to port your VSCode extension to Visual Studio IDE.
  • dTddTd Member Posts: 182
    Nice editor, and your plugin works as advertised. I normally use geaney while editing in linux and textpad while in windows. Textpad has a syntax highlighting plugin already available but I haven't searched one for Geaney. Would be nice to get one though :)
  • CalgacusCalgacus Member Posts: 273
    @Glorwinger & @virusman & @niv

    If the code for the vscode extension could be be rehosted and open sourced I would like to try to help expand on it - hopefully it can get some IntelliSense and a debugger shim.

    Or has someone already done that stuff for some other editor?
  • TarotRedhandTarotRedhand Member Posts: 1,481
    @Calgacus Not that I know of but then again I use notepad++ for practically everything. It has a ton of official plug-ins (e.g. nppexec allows execution of programs external to npp like a commandline NWScript compiler) but neither of those I'm afraid.

    TR
  • DazDaz Member Posts: 125
    Calgacus wrote: »
    @Glorwinger & @virusman & @niv

    If the code for the vscode extension could be be rehosted and open sourced I would like to try to help expand on it - hopefully it can get some IntelliSense and a debugger shim.

    Or has someone already done that stuff for some other editor?

    It's hosted here: https://gitlab.com/glorwinger/vscode-nwscript
  • CalgacusCalgacus Member Posts: 273
Sign In or Register to comment.