View Single Post
Old 09 August 2018, 13:37   #8
earok
Registered User

 
Join Date: Dec 2013
Location: Auckland
Posts: 2,153
Quote:
Originally Posted by MickGyver View Post
Also, it would be very nice to be able to use the code outline view in VS Code:

https://code.visualstudio.com/update...#_outline-view

Did you look into this already @earok? Not trying to stress you or anything.

I made a function list for my Notepad++ extension (RegEx) but I'm not sure how it's done in VS Code.
Eeep.

I'm not quite at that level yet! I could maybe look at that in future. What I was hoping to solve next is code formatting (so you can press SHIFT+ALT+F and have all of the scopes properly tab indented)

There's two main components to what I've done so far. The first is just syntax highlighting, using Visual Studio Codes' standard colors and definitions. For example, this is in the .tmLanguage file

Code:
{
	"name": "keyword.control.operator.blitzbasic",
	"match" : "(?i)\\b(not|bitset|bitclr|bitchg|bittst|lsl|asl|lsr|asr|and|or)\\b"
},
Which simply finds and highlights those operators.

The second part is the "snippets" functionality, which is meant to be used for simple code shortcuts but in practice I find it useful as an intellisense alternative. For example:

Code:
"ReadFile": {
	"prefix": "ReadFile",
	"body": [
		"if ReadFile(File#,Filename$)",
		"\t;Do your file handling here.",
		"\tCloseFile File#",
		"else",
		"\t;The file was not successfully opened. Do your error handling here.",
		"endif"
	],
	"description": "ReadFile opens an already existing file specified by Filename$ for sequential reading. If the specified file was successfully opened, ReadFile will return true (-1), otherwise ReadFile will return false (0). Once a file is open using ReadFile, FileInput may be used to read information from it."
},
  • The root name is simply a unique identifier.
  • If you start typing in the prefix, you'll see this as an option in a list.
  • If you press tab with this option highlighted, the body will be filled out (for readfile I thought it might be useful to have a sensible default template, for example, but for almost all of the other commands it simply fills out the command with placeholder parameters).
  • Finally, description shows if you start typing it in and select it from the list. Just a quick manual reference.

The project is open source and I'm happy to accept pull requests, such as WinUAE/ARREX integration if possible OR, I should be able to add others to have full write access to the repo if required?
earok is offline  
 
Page generated in 0.04459 seconds with 11 queries