Coder Social home page Coder Social logo

mborik / z80-macroasm-vscode Goto Github PK

View Code? Open in Web Editor NEW
52.0 5.0 11.0 728 KB

Support for Z80 macro-assemblers in Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=mborik.z80-macroasm

License: MIT License

TypeScript 100.00%
vscode-extension formatter intellisense problem-matcher syntax-highlighting visual-studio-code vscode z80 z80-assembly z80asm

z80-macroasm-vscode's Introduction

Support for Z80 macro-assemblers in Visual Studio Code

The Z80 Macro-Assembler extension for Visual Studio Code provides the following features inside VS Code:

⚙️ Settings

These few options allows you to configure extension's behavior but primarily your code-formatting preferences and code completion:

  • z80-macroasm.files.exclude - Choose files or directories to exclude (e.g '**/*.{lst}').
  • z80-macroasm.files.include - Files to include and work with. If you, or your macro-assembler using a different conventions of source file extensions then change it here.

    default: "**/*.{a80,asm,inc,s}"

  • z80-macroasm.seekSymbolsThroughWorkspace - If true, extension will crawl through all your workspace files to document all symbols. Otherwise, only includes are taken into account.

    default: false

Formatter:

  • z80-macroasm.format.enabled - Turn on the experimental feature of format on-type or on-save.

    default: false

  • z80-macroasm.format.baseIndent - How many tabstops you prefer before the instructions or keywords.

    default: 2

  • z80-macroasm.format.controlIndent - How many tabstops you prefer before the control structure keywords, selections, modules, or blocks.

    default: 1

  • z80-macroasm.format.whitespaceAfterInstruction - Which type of whitespace you want to put after the instruction - "tab", "single-space" or "auto" which autodetect file's tabstop type and width.

    default: "auto"

  • z80-macroasm.format.spaceAfterArgument - If you want to put a single space character after comma (instruction's argument).

    default: false

  • z80-macroasm.format.spaceAfterInstruction - If you want to put a single space character after instruction (before colon separator).

    default: true

  • z80-macroasm.format.spacesAroundOperators - If you want to wrap an operators with spaces.

    default: false

  • z80-macroasm.format.uppercaseKeywords - If true, uppercase all keywords, instructions and registers. False means all lowercased and "auto" tries to auto-detect your code-style while typing.

    default: "auto"

  • z80-macroasm.format.bracketType - Define which type of brackets around the instruction's arguments (pointers) you prefer: (round) or [square].

    default: "no-change"

  • z80-macroasm.format.colonAfterLabels - Put colon after each label or symbol (true or false, "no-change" keeps it untouched).
  • z80-macroasm.format.hexaNumberStyle - Define which hexadecimal number format you prefer to reformat:
    • "no-change" - no reformat happen (default)
    • "hash": #1fff | #B45D
    • "motorola": $1fff | $B45D
    • "intel": 1fffh | 0B45Dh
    • "intel-uppercase": 1fffH | 0B45DH
    • "c-style": 0x1fff | 0xB45D
  • z80-macroasm.format.hexaNumberCase - When reformatting of hexadecimal numbers was enabled, whether it's to be additional case processing applied when true means uppercased, false lowercased.

    default: "no-change"

  • z80-macroasm.format.suggestOnInstructions - Extension will suggest also basic instruction mnemonics for the auto-completion, not only instruction arguments.

    default: false

  • z80-macroasm.format.splitInstructionsByColon - Split colon separated instructions to lines.

    default: true

These keys/values can be used in your workspace or global settings.json. See example »»

🚨 Problem matchers

There are some predefined problem matchers to handle reported errors from compilation output:

  • errmatcher-as for Macroassembler AS
  • errmatcher-sjasmplus for SjASMPlus
  • errmatcher-sjasm for SjASM
  • errmatcher-pasmo for Pasmo
  • errmatcher-rasm for rasm
  • errmatcher-tniasm and errmatcher-tniasm-preprocessor for tniASM

These values can be used in .vscode/tasks.json of your project's build task. See example »»

💡 IntelliSense showcase

Symbol suggestions:

  • provide symbols or labels
    • in current file in "Go to Symbol in File..." [Ctrl+Shift+O, Cmd+Shift+O]
    • in all includes in "Go to Symbol in Workspace..." [Ctrl+T, Cmd+T]
    • in Outline side-bar

Definitions:

Definitions

  • Generated map of every symbol defined considers also modules or temporal labels:

Peek Definition demo

  • Show symbol's value or specific definiton on hover:

Hover over symbol demo

Completion:

Completion

  • Inteligent completion of directives, pseudo-instructions, Z80 instructions, registers, labels or symbols:

Completion demo

Renaming:

  • Allow to rename labels, local labels, module names or macro indetifiers in InteliSense meaning.

Renaming demo

⌨️ Credits

Martin Bórik is leading the development of this extension with some inspirations from these VS Code extensions:

Contributors:

📋 License

The Z80 Assembly extension is subject to these license terms.

The source code to this extension is available on github and licensed under the MIT license.

z80-macroasm-vscode's People

Contributors

alexanderk23 avatar iiivan37 avatar imanolea avatar kolnogorov avatar mborik avatar rgiot avatar thenestruo avatar tomaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

z80-macroasm-vscode's Issues

Allow to disable asm auto-completion

Hi,

I feel this plug-in almost perfect but for the asm auto-completion, IMHO very intrusive. The asm language is "short" to write, the completion boxes appearing so frequently for short writes can be distracting, and sometimes you have to press even more keys, i.e. when writing "ret", have to press enter 2 times for going to the next line.
Then I see very useful the auto-completion of labels, but not so much for the asm code itself. If I could disable it I'd do.

Thanks for the plug-in to all this.

Work with other file types

I have tried every permutation possible (or so it seems) to get this package to recognise the assembler file extensions I'm using - .Z80. For some reason, it refuses to code-highlight or otherwise work with my Z80 assembly files with the .Z80 extension. I've saved the exact same file as a .ASM file and it works fine with that. I've edited the settings and added .Z80 into the 'Files: include' array (**/*.{z80,asm,inc,s}) and have edited the JSON directly, but to no avail.

Any suggestions?

Opening of included file

It would be nice if it was possible to open (in a new tab) included files by using a key shortcut when the cursor is on an include line directive (or equivalent) or by CTRL-clicking on the filename.

Snippets in VSCode

Hello.
VSCode has built-in support of snippets.
But the way they are handled by your great extension is not perfect.

Let me explain.

At this gif you can see, how snippets works in SublimeText - they are perfectly formatted and ready to use right after typing it.
Sublime

Now, let's add same snippet into VSC:
snippetTXT

and then try to use it:
VSC

As you can see, snippet is not properly formatted (pay attention to the label) and demands some handwork to get it to the usable state.
And note, please - I've used a very simple example of snippet - look at this one:
basic
In VSCode, we'll need much more formatting work in this case.

So, question is simple: is it possible to solve this problem and use snippets with more efficiency?

TASM support?

TASM seems like quite a popular assembler, and the tutorial that I'm following uses it. It isn't listed on the list of compatible assemblers, though - would it be hard to add?

Extension doesn't seem to respect acceptSelectedSuggestion

Hi! Thanks for this great extension. I seem to have a problem though.

It seems that code completion for things like register and label names provided by this extension is handled differently from other completions. When I change the keybinding for acceptSelectedSuggestion from Enter to something else, pressing enter still completes the selection, except now it also moves the cursor down. Snippets respect the change, though.

Definition not found

Local labels are not always found. E.g.

Bildschirmfoto 2019-03-10 um 11 55 02

The label .l12 is defined locally but it is not found via g1.l12.

Respect editor settings

Do you check the editor settings (.vscode)?
Seems like the asm editor is inserting tabs instead of spaces as my editor settings say...

Other than that, excellent extension!

splitInstructionsByColon: false doesn't work properly

I am the guy who writes many instruction in one line, separated by colon, so, i need to have splitInstructionsByColon set to false.

But eventually, when it's set to false, you just can't write space symbol after colon (because it's trimmed), so it's impossible to type more than one instruction in a line:

main.asm.-.aggregation.-.Visual.Studio.Code.Administrator.2021-12-07.15-46-36.mp4

Recognized symbols not available as definitions (tniASM specific issue?)

Hello!

In my tniASM 0.45 projects (e.g.: the include-heavy msx-msxlib or the much simpler msx-pyramidwarpex) no definitions are available:
image

However, they appear in the outline view:
image

And also appear when I "Go to Symbol in Workspace...":
image

Note 1: In other projects using different assemblers (e.g.: this one that uses Sjasm 0.39) definitions are correctly found and available.

Note 2: I don't know if it is related to this issue or if it is just a red herring, but assembler directives (IFDEF / IFEXIST / ENDIF) are recognized as symbols:
image

Thanks!

M80 accepts `$` in identifiers/labels

I have some old Z80 sources that I wrote for the M80 assembler.

As M80 accepts $-signs in labels I used those, but those are not correctly identified here. My guess would be that this line

      "match": "\\b([a-zA-Z][\\w\\.]+)\\b",

should be changed to

      "match": "\\b([a-zA-Z][\\w\\.$]+)\\b",

(see

"match": "\\b([a-zA-Z][\\w\\.]+)\\b",
)

but I am not experienced with writing extensions so would first see if it was an easy fix for a maintainer.

Add support for region folding

This can be achieved by adding this to language.configuration.json:

  "folding": {
    "markers": {
      "start": "^\\s*;\\s*#?region\\b",
      "end": "^\\s*;\\s*#?endregion\\b"
    }
  }

Format of hexadecimal numbers

⚙ Preparation

Add enum-type setting "z80-macroasm.format.hexaNumberStyle" with these options:

  • "no-change"
  • "hash": #1fff | #B45D
  • "motorola": $1fff | $B45D
  • "intel": 1fffh | 0B45Dh
  • "intel-uppercase": 1fffH | 0B45DH
  • "c-style": 0x1fff | 0xB45D

and "z80-macroasm.format.hexaNumberCase" setting of semi-boolean type [ "no-change", true, false ]. True will be uppercased, false lowercased.

📝 Feature description

Formatter implementation will be enhanced to detect and parse hexadecimal numbers in source-code and reformat it into user's preference given by settings defined above.

sjasm module name is deleted on save

Hello and thanks for the great plugin!

I am having issues with saving files when I use sjasmplus module construct, the module name is erased:

Before saving:

    MODULE name
    ;; code
    ENDMODULE

After saving:

    MODULE
    ;; formatted code
    ENDMODULE

Using version 0.7.1, vscode 1.55.2

Suggestion - update problemmatcher for sjasmplus to filelocation autodetect

Hi there - thanks for this plugin!
I am setting up my environment and I like to locate my .asm files in a subfolder of the main project solution and although the $errmatcher-sjasmplus problem matcher is correctly detecting the error in the assembly output, sjasmplus does not include the relative path when displaying the error:

> Executing task: D:\next\DMTestBong\project\bin\sjasmplus d:\next\DMTestBong\project\src\Project.asm --zxnext=cspect --msg=all <


SjASMPlus Z80 Cross-Assembler v1.14.5 (https://github.com/z00m128/sjasmplus)
Pass 1 complete (0 errors)
Pass 2 complete (0 errors)
Project.asm(17): error: Unrecognized instruction: fred a, bill
Pass 3 complete
Errors: 1, warnings: 0, compiled: 57 lines, work time: 0.031 seconds
The terminal process terminated with exit code: 1

With the $errmatcher-sjasmplus defined as:

{
	"name": "errmatcher-sjasmplus",
	"owner": "z80-macroasm",
	"fileLocation": ["relative", "${workspaceFolder}"],
	"pattern": [
		{
			"regexp": "^(.*)\\(([0-9]+)\\): (error|warning):\\s+(.*)$",
			"file": 1,
			"line": 2,
			"severity": 3,
			"message": 4
		}
	]
},

clicking the error in the Problems list results in an error as the file is assumed to be relative to the workspace folder.

However, if I amend my build task to include the --fullpath switch:

> Executing task: D:\next\DMTestBong\project\bin\sjasmplus d:\next\DMTestBong\project\src\Project.asm --zxnext=cspect --msg=all --fullpath <


SjASMPlus Z80 Cross-Assembler v1.14.5 (https://github.com/z00m128/sjasmplus)
Pass 1 complete (0 errors)
Pass 2 complete (0 errors)
d:\next\DMTestBong\project\src\Project.asm(17): error: Unrecognized instruction: fred a, bill
Pass 3 complete
Errors: 1, warnings: 0, compiled: 57 lines, work time: 0.015 seconds
The terminal process terminated with exit code: 1

Press any key to close the terminal.

This time, clicking the error in the Problems list results in an error as the file is still assumed to be relative to the workspace folder.

However, if I edit the extension package.json to use "autodetect":

{
	"name": "errmatcher-sjasmplus",
	"owner": "z80-macroasm",
	"fileLocation": ["autodetect", "${workspaceFolder}"],
	"pattern": [
		{
			"regexp": "^(.*)\\(([0-9]+)\\): (error|warning):\\s+(.*)$",
			"file": 1,
			"line": 2,
			"severity": 3,
			"message": 4
		}
	]
},

The problem path works whether the .asm file is in the workspace folder or nested lower.

Label autocompletion seems wrong when using local labels

Let's use this example:

global
	ld hl, global
	ld de,  ; Cursor is before the comment

.local

If I type .l<tab> I expect to obtain .local.
Instead I obtain .global.local that is totally invalid.
global.local would be valid, but it is preferable to not have the global part as we are already in its scope.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.