bergercookie / asm-lsp

Language server for NASM/GAS/GO Assembly
https://crates.io/crates/asm-lsp
BSD 2-Clause "Simplified" License
239 stars 13 forks source link

fix: proper usage of compile_flags.txt for diagnostics #142

Closed WillLillis closed 1 month ago

WillLillis commented 1 month ago

This corrects the treatment of compile_flags.txt during the server's generation of diagnostics. The server now treats compile_flags.txt files correctly, as if they only contain flags. If such a file is loaded, the server will attempt to invoke gcc with the provided flags. If it fails to invoke gcc, it will also try clang. There is a new opts section of .asm-lsp.toml with an optional compiler entry. If the compiler field is set, the server will attempt to invoke the provided compiler in order to generate diagnostics.

This also enables diagnostics by default. That is, if no compile command applies to the source file when a request comes in, the server will still try to invoke gcc (and if that fails, clang) on the contents of the current buffer, with the file path being the only argument. This enables diagnostics even when no compile_commands.json or compile_flags.txt are available for the current project.

Closes #138