Page 2 of 18

Re: Syntax highlighting

Posted: Wed Jun 20, 2018 1:24 pm
by Hazelnut
TheLacus,

I figured out what the problem is. So for the VSCode file dftemplate.tmLanguage file, would you be able to change the following things:
  • Fix the non-matching close tags 'ley' to 'key'.
  • Move the comments to before the entire 'dict' entries for each match block. (see example below)
Then creating an Atom grammar package can be done with a single command.

Example:

Code: Select all

			<!-- comment THIS ONE IS OK - MOVE TO HERE -->
			<dict>
				<!-- comment THIS ONE IS BAD - REMOVE FROM HERE -->
				<key>match</key>
				<string>^(-)+.*$</string>
				<key>name</key>
				<string>comment.line.double-dash</string>
			</dict>
EDIT:
Have attached an updated version with the above changes made.

Want to clarify this is a query, separate from the changes requested above that will allow automated generation of Atom syntax highlighting...
Also, could the syntax be called something like 'Daggerfall Quests' rather than 'DfTemplate'? (for selecting in the editors I mean rather than filenames etc)
So, change

Code: Select all

<key>name</key><string>DfTemplate</string>
to

Code: Select all

<key>name</key><string>Daggerfall Quests</string>

Re: Syntax highlighting

Posted: Wed Jun 20, 2018 5:55 pm
by TheLacus
Hazelnut wrote: Wed Jun 20, 2018 1:24 pm TheLacus,

I figured out what the problem is. So for the VSCode file dftemplate.tmLanguage file, would you be able to change the following things:
  • Fix the non-matching close tags 'ley' to 'key'.
  • Move the comments to before the entire 'dict' entries for each match block. (see example below)
Then creating an Atom grammar package can be done with a single command.
Good work finding the issue, is surely a good thing to have a single base to use for multiple editor. I also have some reworking to do, maybe i'll push it to git in order to accept changes if someone want to help.

As far as i understand Template is the name of the language, i've only added df to make it less generic. I agree to have a more readable visible name, not sure about omitting template. Maybe something like Daggerfall Quest Template?
Jay_H wrote: Wed Jun 20, 2018 11:51 am It's working now, and magnificently. Thank you TheLacus!
Happy you liked it, feel free to give any suggestion or critic. I think snippets can be quite useful when you want to write a long query, for example try to type wave ;)

Right now i'm trying to add some basic support for Intellisense. I'm a bit lost because i never used typescript before, but i'm making slow progresses...

hover.png
hover.png (6.26 KiB) Viewed 11701 times

Re: Syntax highlighting

Posted: Wed Jun 20, 2018 7:55 pm
by Hazelnut
TheLacus wrote: Wed Jun 20, 2018 5:55 pm As far as i understand Template is the name of the language, i've only added df to make it less generic. I agree to have a more readable visible name, not sure about omitting template. Maybe something like Daggerfall Quest Template?
I was not clear. I mean simply the part of the file that defines the name of the syntax highlighting, not the other names or the file extension. So line 12 of the dftemplate.tmLanguage, according to what I read this is the name that will show up in editors as the display name of the syntax highlighting definition. If you want to keep the word template in there that's fine, but I think changing this to a more human readable name would be nice. Certainly none of the other syntax definitions in Atom (called grammars in Atom) have the word template in.

Re: Syntax highlighting

Posted: Wed Jun 20, 2018 9:04 pm
by TheLacus
Hazelnut wrote: Wed Jun 20, 2018 7:55 pm
TheLacus wrote: Wed Jun 20, 2018 5:55 pm As far as i understand Template is the name of the language, i've only added df to make it less generic. I agree to have a more readable visible name, not sure about omitting template. Maybe something like Daggerfall Quest Template?
I was not clear. I mean simply the part of the file that defines the name of the syntax highlighting, not the other names or the file extension. So line 12 of the dftemplate.tmLanguage, according to what I read this is the name that will show up in editors as the display name of the syntax highlighting definition. If you want to keep the word template in there that's fine, but I think changing this to a more human readable name would be nice. Certainly none of the other syntax definitions in Atom (called grammars in Atom) have the word template in.
I understand what you're saying and i don't have a strong opinion on this, i just always considered Template as the proper name of the compiler/output format by Tipton and not just as a generic term. If this is confusing to quest writers i'm happy to even rename the entire thing Daggerfall Quests, rather than have inconsistencies.

Anyway, some more work on Intellisense, with definitions docs read from a json file.

hover.png
hover.png (24.39 KiB) Viewed 11680 times

Re: Syntax highlighting

Posted: Wed Jun 20, 2018 9:28 pm
by Hazelnut
TheLacus wrote: Wed Jun 20, 2018 9:04 pm I understand what you're saying and i don't have a strong opinion on this, i just always considered Template as the proper name of the compiler/output format by Tipton and not just as a generic term. If this is confusing to quest writers i'm happy to even rename the entire thing Daggerfall Quests, rather than have inconsistencies.
Ah, I think I was the one confused - sorry. Thought you meant template as the syntax highlighting format, but I had just assumed that. Makes perfect sense now, and I feel :oops: having not made that connection. I think I will scuttle into a quiet corner and leave this to you. :D

Good luck with the intellisense stuff! Looks awesome.

Re: Syntax highlighting

Posted: Thu Jun 21, 2018 1:12 am
by Jay_H
TheLacus wrote: Wed Jun 20, 2018 5:55 pmI think snippets can be quite useful when you want to write a long query, for example try to type wave ;)
I tried typing wave but nothing happened. I tried looking for snippets, and I know there's a snippet file in your download, but I'm not seeing it happen.

Image

Re: Syntax highlighting

Posted: Thu Jun 21, 2018 7:19 pm
by TheLacus
@Hazelnut
That's ok, i can see where the confusion come from. I'm always happy to receive suggestions :)

@Jay_H
The window opened in your screenshot has the user snippets, the file with language snippets is inside ./snippets/dftemplate.json. Look for snippets in editor options, there are a few modes. default should be "editor.snippetSuggestions": "inline", but you might have it on "none".
Also note that i made a few changes after first upload, try to download the files again to be sure to be on latest version.

Re: Syntax highlighting

Posted: Thu Jun 21, 2018 8:20 pm
by Jay_H
I just added the newest version, and I have it on inline too, but nothing's changed... To be honest I'm not sure what I'm expecting :lol: If I can't get it to work, the highlighting alone is good enough, and I'm happy with it alone.

Re: Syntax highlighting

Posted: Fri Jun 22, 2018 7:16 pm
by TheLacus
I worked on go to definition/peek definition and also used it to provide more informations on tooltip. When you are over a symbol, it tells you the meaning according to prefix and type. Next step is to add red underline on incorrect usage (es __foo_ as a clock etc.)

Image

Image

Image
Jay_H wrote: Thu Jun 21, 2018 8:20 pm I just added the newest version, and I have it on inline too, but nothing's changed... To be honest I'm not sure what I'm expecting :lol: If I can't get it to work, the highlighting alone is good enough, and I'm happy with it alone.
As you type, a dropdown menu appears. If you select the proposed entry, a pre-made text is pasted and you only have to fill fields. ;)

Re: Syntax highlighting

Posted: Fri Jun 22, 2018 9:52 pm
by Interkarma
Oh wow! This just keeps getting better. Between this, DFU's runtime compilation of quest scripts, console commands, and quest lists, we basically have an end-to-end Daggerfall quest IDE and test sandbox right now.

All we need now is a proper step through debugger for quest scripts, which is something I started planning but didn't execute due to time constraints.

Edit: Stickied this to Quest Hub. I think that's the best place for it.