Page 4 of 18

Re: Syntax highlighting

Posted: Tue Aug 07, 2018 8:12 pm
by TheLacus
As usual, a summary of what i've been working on.

Quest tables
I had already formatted some constants in a json file to develop autocompletion, now i have decided to avoid duplication and read data directly from tables used for Daggerfall Unity. When the path to StreamingAssets/Tables is set (or retrieved automatically when working inside the standard folder in StreamingAssets) Quests-xxx.txt files are read by extension and used to suggest proposals based on action signature as well as detect issues with existing quests. Ideally this should guarantee that quest engine and editor always rely on the same data if there are any changes (example: an unused global variable reserved by custom quests).

Image

Symbol proposal
Autocompletion is now filtered by parameter type, to avoid suggestions that would surely be incorrect. I already wrote the action/condition backend so this was just a natural progression.

Image

Symbol variations
Proposes symbol variations as code action and detects undefined prefixes for type. This should make them a bit less enigmatic for new quest writers. :)

Image

Re: Syntax highlighting

Posted: Tue Aug 07, 2018 10:57 pm
by Interkarma
This is amazing, I especially love the symbolic variations!

I spent a lot of time with my head in the head system last year and I can see all the problems you're helping solve here. You're laying the groundwork for a whole new generation of quest authors.

Re: Syntax highlighting

Posted: Tue Aug 14, 2018 6:31 pm
by Jay_H
I'm getting some obstacle in VS Code while trying to edit my user settings, telling me 'cannot edit in read-only editor'. I dunno how I triggered read-only and apparently others are bothered by it (http://github.com/Microsoft/vscode/issues/51021). I worked around it using the Workspace Settings, though. This is just FYI for future users.

I have to say this is far easier than keeping my 3 Notepad windows open at the same time :lol: This is the 21st century! Hurrah! I don't appear to have all the named features present, but I do love the definition actions and the little hover tooltip you have for symbols. A very good presentation. Thank you again for undertaking this project.

A little more poking around tells me this thing is amazing. I had no idea my quests had so many problems! This is awesome!

By the way, what does it mean when it says my quests are Untracked? I have that flag next to nearly all of mine.

Re: Syntax highlighting

Posted: Tue Aug 14, 2018 7:39 pm
by TheLacus
Hey Jay_H, i'm happy that you like it. I'm very interested in any feedback and suggestion you may have :D
Jay_H wrote: Tue Aug 14, 2018 6:31 pm I'm getting some obstacle in VS Code while trying to edit my user settings, telling me 'cannot edit in read-only editor'. I dunno how I triggered read-only and apparently others are bothered by it (http://github.com/Microsoft/vscode/issues/51021). I worked around it using the Workspace Settings, though. This is just FYI for future users.
Just to be certain, there are two columns: defaults on the left (readonly) and two tabs on the right (user and workspace). Settings are overridden in this order: workspace (folder) > user > defaults.
Be sure you were not trying to edit the left column; i'm not sure the link is related, i think is just a standard message for read-only files. Otherwise there might be some permission issue with the file on disk.
This page has a good explanation if you have any doubt about settings. Also note a UI based editor for settings is available, it should be proposed from a link on top of settings page.

Jay_H wrote: Tue Aug 14, 2018 6:31 pm I have to say this is far easier than keeping my 3 Notepad windows open at the same time :lol: This is the 21st century! Hurrah! I don't appear to have all the named features present, but I do love the definition actions and the little hover tooltip you have for symbols. A very good presentation. Thank you again for undertaking this project.
Features from most recent posts are not yet in current version. I also think it can be helpful to highlight the difference between File > open folder and File > open workspace.
When you open a folder, the .json settings file in it is loaded and used for all files.
A workspace is a bit more advanced as it allows to open more folders in the same instance; for example you can open StreamingAssets/Quests and StreamingAssets/QuestPacks/JH. This allows the extension to suggest quest names from other folders and find references to global variables.
To create a workspace use File > Save Workspace as..., then Add folder to workspace. You'll get a (text) file which can be opened fom File > open workspace. This page has a longer explanation.
Jay_H wrote: Tue Aug 14, 2018 6:31 pm A little more poking around tells me this thing is amazing. I had no idea my quests had so many problems! This is awesome!
Note that there may be a few actions which are not recognised (i know about used do because it doesn't start with a constant name); these will be fixed as i find them.
Jay_H wrote: Tue Aug 14, 2018 6:31 pm By the way, what does it mean when it says my quests are Untracked? I have that flag next to nearly all of mine.
This is Github, it means these files are not synced with your repository. Once a file is added, it should change to M for any future changes or nothing if is up to date.

Re: Syntax highlighting

Posted: Tue Aug 14, 2018 8:17 pm
by Jay_H
Great! Thanks for the info. I seem to have ironed out a lot of the things above.

One minor issue is that sometimes I get a green error label when something is defined as a _symbol_ and is used as a =symbol_. VS Code doesn't recognize the =symbol_ as a use, so it says _symbol_ is an unused defined variable.

Re: Syntax highlighting

Posted: Tue Aug 14, 2018 8:25 pm
by TheLacus
Jay_H wrote: Tue Aug 14, 2018 8:17 pm Great! Thanks for the info. I seem to have ironed out a lot of the things above.

One minor issue is that sometimes I get a green error label when something is defined as a _symbol_ and is used as a =symbol_. VS Code doesn't recognize the =symbol_ as a use, so it says _symbol_ is an unused defined variable.
Thank you, i'll give it a look :)

Re: Syntax highlighting

Posted: Sat Aug 18, 2018 6:36 am
by Jay_H
The _itemsymbol_ used do _tasksymbol_ condition isn't implemented in the editor, but it works in DFU. It's the only reason I have red marks on my quests :D

Re: Syntax highlighting

Posted: Sat Aug 18, 2018 12:23 pm
by TheLacus
I know, i told you in a post above. This will be resolved in the next version ;)

I have a question for Interkarma: comments must start with the first char of the line, it is not correct to have something like " -- text" or "give pc _reward_ -- text", isn't it ? I think in some cases the trailing part of the line is ignored once the leading has been accepted and parsed, but i wanted to check with you if this is to be considered safe or i should mark it as an error.

Re: Syntax highlighting

Posted: Sat Aug 18, 2018 2:20 pm
by Jay_H
Ah, darn it. I don't read instructions well on the first try :D Thanks for letting me know.

Re: Syntax highlighting

Posted: Sat Aug 18, 2018 10:28 pm
by Interkarma
TheLacus wrote: Sat Aug 18, 2018 12:23 pm I have a question for Interkarma: comments must start with the first char of the line, it is not correct to have something like " -- text" or "give pc _reward_ -- text", isn't it ? I think in some cases the trailing part of the line is ignored once the leading has been accepted and parsed, but i wanted to check with you if this is to be considered safe or i should mark it as an error.
A comment line needs only start with a single "-" dash character and anything after it is ignored. It's not technically supported to place comments after the line, although a regex match will ignore everything after the match so it's possible.

Still, I'd prefer the syntax highlighting to only support intended comment usage and perhaps look at adding a different style of comment sequence for both single lines and trailing comments. Probably adding good old C // comment support would make the most sense. I mainly went with "-" as it was already being generated by TEMPLATE and was required for backward compatibility.