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: 1575
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel »

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
Developer
Posts: 452
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron »

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: 1575
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel »

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
Developer
Posts: 452
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron »

Code: Select all

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

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

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel »

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
Developer
Posts: 452
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron »

Alright, then. It's updated. :)

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

Re: VS Code - WML Syntax highlightning

Post by Bitron »

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

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

Re: VS Code - WML Syntax highlightning

Post by Celtic_Minstrel »

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
Developer
Posts: 452
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlightning

Post by Bitron »

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

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

Re: VS Code - WML Syntax highlighting

Post by Celtic_Minstrel »

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
Developer
Posts: 452
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: VS Code - WML Syntax highlighting

Post by Bitron »

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.

User avatar
Ravana
Forum Moderator
Posts: 2287
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: VS Code - WML Syntax highlighting

Post by Ravana »

$variables could use separate color.

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

Re: VS Code - WML Syntax highlighting

Post by Bitron »

True. Should be able to make it next week.

Post Reply