Skip to content

Commit

Permalink
feat: Add user-visible error on invalid config
Browse files Browse the repository at this point in the history
Co-authored-by: Ulta-Code <[email protected]>

improve config section in README

cut down on argument counts to functions, re-enable lint

Send warning to user if no config file is found

fix: Properly deserialize ARM64, fix diagnostics behavior

cut down on redundant code

Refactor main loop
  • Loading branch information
WillLillis committed Nov 3, 2024
1 parent 5e66331 commit abfd3ff
Show file tree
Hide file tree
Showing 23 changed files with 1,059 additions and 981 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ items_after_statements = "allow"
cast_possible_truncation = "allow"
module_name_repetitions = "allow"
too_many_lines = "allow"
too_many_arguments = "allow"
similar_names = "allow"

# Taken from tree-sitter's `Cargo.toml`
Expand Down
61 changes: 50 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,22 @@ Add a section like the following in your `settings.json` file:

Add a `.asm-lsp.toml` file like the following to your project's root directory
and/or `~/.config/asm-lsp/` (project configs will override global configs) to
selectively target specific assemblers and/or instruction sets. Omitting an item
from the `assemblers` or `instruction_sets` sections is equivalent to setting it
to `false`. Be default, diagnostics are enabled and the server attempts to invoke
`gcc` (and then `clang`) to generate them. If the `compiler` config field is specified,
the server will attempt to use the specified path to generate diagnostics. Different
configurations can be created for different sub-directories or files within your
project as `project`s. Source files not contained within any `project` configs will
use the default configuration if provided.
selectively target specific assemblers and/or instruction sets. By default, diagnostics
are enabled and the server attempts to invoke `gcc` (and then `clang`) to generate
them. If the `compiler` config field is specified, the server will attempt to use
the specified compiler to generate diagnostics. Different configurations can be
created for different sub-directories or files within your project as `project`s.
Source files not contained within any `project` configs will use the default configuration
if provided.

#### NOTE

If the server reads in an invalid configuration file, it will display an error
message and exit.

```toml
[default_config]
assembler = "Go"
assembler = "go"
instruction_set = "x86/x86-64"

[opts]
Expand All @@ -76,12 +80,47 @@ default_diagnostics = true
# Configure the server's treatment of source files in the `arm-project` sub-directory
[[project]]
path = "arm-project"
assembler = "Gas"
assembler = "gas"
instruction_set = "arm"

# NOTE: Specifying the `opts` field isn't necessary
[project.opts]
compiler = "zig"
compile_flags_txt = [
"cc",
"-x",
"assembler-with-cpp",
"-g",
"-Wall",
"-Wextra",
"-pedantic",
"-pedantic-errors",
"-std=c2y",
"-target",
"aarch64-linux-musl",
]
```

Valid options for the `instruction_set` field include:

- `"x86"`
- `"x86-64"`
- `"x86/x86-64"` (Enable both)
- `"arm"`
- `"arm64"`
- `"riscv"`
- `"z80"`

Valid options for the `assembler` field include:

- `"gas"`
- `"go"`
- `"masm"`
- `"nasm"`

Don't see an architecture and/or assembler that you'd like to work with? File an
[issue](https://github.com/bergercookie/asm-lsp/issues/new/choose)! We would be
happy to add new options to the tool.

### [OPTIONAL] Extend functionality via `compile_commands.json`/`compile_flags.txt`

Add a [`compile_commands.json`](https://clang.llvm.org/docs/JSONCompilationDatabase.html#format)
Expand Down
Loading

0 comments on commit abfd3ff

Please sign in to comment.