VS Code - WML Syntax highlighting

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
User avatar
Celtic_Minstrel
Developer
Posts: 1225
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel » April 1st, 2018, 5:45 pm

I just noticed that it doesn't seem to hilite augmentation tags correctly? Like [+units] and such.

There also seem to be a few (very minor) bugs with the automatic indent/outdent. In particular, tags in comments count when it's deciding whether to indent, and placing the closing tag on the same line as the opening tag still outdents. I also had it break entirely at one point and had to disable/re-enable the extension to get it back, but I have no idea how to reproduce it.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Bitron
Moderator
Posts: 439
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron » April 21st, 2018, 1:35 pm

Well, all I did to have the indentation work was this:

Code: Select all

    "indentationRules": {
	"increaseIndentPattern": "\\[([_A-Za-z0-9]*)\\]",
	"decreaseIndentPattern": "\\[\\/([_A-Za-z0-9]*)\\]"
    }
Unfortunately I really have no idea how to fix that.
About the [+units], I there should be a way to fix it, but I haven't found it yet.

User avatar
Celtic_Minstrel
Developer
Posts: 1225
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel » April 21st, 2018, 4:07 pm

Hmm, what about adding ^\\s* to the beginning of both patterns? I think that might fix most of the indent bugs, though it may still indent if you type [tag][/tag] on one line...
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Bitron
Moderator
Posts: 439
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron » April 21st, 2018, 9:34 pm

Code: Select all

    "indentationRules": {
		"increaseIndentPattern": "^\\s*\\[([_A-Za-z0-9]*)\\]",
		"decreaseIndentPattern": "^\\s*\\[\\/([_A-Za-z0-9]*)\\]"
	}
like this?

User avatar
Celtic_Minstrel
Developer
Posts: 1225
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel » April 21st, 2018, 10:09 pm

That's what I proposed, yeah. I think it should work provided that those patterns match only a specific line.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Bitron
Moderator
Posts: 439
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron » April 21st, 2018, 10:22 pm

Alright, then. It's updated. :)

User avatar
Bitron
Moderator
Posts: 439
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron » April 30th, 2018, 8:08 pm

Just uploaded another small update. Version 1.0.5 adds `#ifhave` and `#ifnhave` to the recogniced syntax.

User avatar
Celtic_Minstrel
Developer
Posts: 1225
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel » May 1st, 2018, 12:05 am

Which reminds me, are #arg and #endarg supported yet?
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Bitron
Moderator
Posts: 439
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron » May 1st, 2018, 8:08 am

Yes I think so. Lemme check.
Edit: yep, they are.

User avatar
Celtic_Minstrel
Developer
Posts: 1225
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: VS Code - WML Syntax highlighting

Post by Celtic_Minstrel » August 4th, 2018, 2:24 am

This might be asking for a lot, but I wonder how difficult it would be to add outline support? I'm thinking of something kinda similar to the JSON outline support... or maybe just note the tag hierarchy? Though it'd also be awesome to have special support for event tags, and perhaps a few other common tag types - for example, listing the event's name and ID in the outline.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Bitron
Moderator
Posts: 439
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlighting

Post by Bitron » August 6th, 2018, 8:39 am

I think that's a bit above my skills, at least currently, but surely an interesting idea.
I will add a note to the maybe-in-future-features. :)
Recognizing syntax errors is on top of that list.

Post Reply