Comments (5)
I have made a bit of progress. Got the static checker working properly with the ranges. Will be working on seeing if I can get the builders to do it appropriately.
https://github.com/SethGower/hdl_checker/tree/range-fixes
from hdl_checker.
Hi I think the best solution is to just send end column = start column + 1.
ModelSim, GHDL and Vivado have no message where they return both start and end columns and I could not think of any way to guess the end column reliably without slowing down the entire server.
I saw you're using the text in quotes to do that, but a quick test illustrates what I mean. This code
entity some_entity is
end some_entity_name;
Produces the message
Line 1, column 21: Labels do not match: 'some_entity' and 'some_entity_name'.
So if you take column 21 (it's in the end) and use the length of some_entity
to infer where the range starts, you'd get column 10 and the editor would show
which is also not correct.
All things considered, the error text showing up next to the line that's causing it is good enough -- adding better column ranges is only marginally better.
from hdl_checker.
Ok, that makes sense. What builder were you using for that example? I tried using GHDL (don't have vivado installed, and msim doesn't provide column numbers). GHDL doesn't give the column of the end of the token, but the beginning.
test1.vhd:2:5:error: misspelling, "some_entity" expected
ghdl:error: compilation error
Output of ghdl --version
GHDL 1.0.0 (tarball) [Dunoon edition]
Compiled with GNAT Version: 11.1.0
llvm code generator
Written by Tristan Gingold.
Copyright (C) 2003 - 2021 Tristan Gingold.
GHDL is free software, covered by the GNU General Public License. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
from hdl_checker.
I used modelsim for that example.
The error message parsing won't really care where the column is, the only difference is that using ghdl would result in an error in column 5 while modelsim would mark column 21, which I find acceptable to be honest.
You can think of a hierarchy of messages:
- (some messages are outright ignored)
- messages without line or column are placed in the first line and first character
- if there's a line number but no column, place the message in the first colmnn
- if there's a line and a column, place the message at that character (nothing is inferred)
That being said, there's some static checks (for example unused signals, ports, etc) which are parsed in Python and in that case there can be a real range rather than a single character.
(hopefully I'm not making things more confusing!)
from hdl_checker.
That makes sense. I feel like it can be done so that it won't cause errors with the other builders. Like if we know the behavior from modelsim (which column it says) it can be modified in the msim.py
so that it doesn't affect anything else.
Now that you mention the static checks, I have that working and I believe that should be appropriate ranges. Currently only have a bug that it doesn't calculate them properly when more than one signal is declared on one line, like
signal a,b,c : std_logic;
I believe it's an issue with the regex, since it gives the range as being the start column where the name is, and then the length of the whole block of signal names + start as the end. So the diagnostic for that example would extend 5 characters after c. It's weird, but I am sure I can figure it out. I was on vacation last week, so I didn't do any work on it.
My big problem was the columns provided by the server break the LSP spec. So if you want to just do the first column as the location of an error, then the range should be 0:1
.
from hdl_checker.
Related Issues (20)
- [feature] use shtab
- [feature] format code
- [feature] create a .gitignore in .hdl_checker
- [BUG] vscode-plugin: hdl_checker-script.py is being executed after vscode-close -> overloads CPU HOT 1
- [feature] Include modelsim's vsim for linter
- not support Python 3.12 HOT 1
- Question: Are the cache.json files generated safe to publish? HOT 2
- Add support for .f file lists HOT 1
- [Question] Managing component dependencies and more HOT 1
- [Question] LSP hover information and dependencies navigation functionalities HOT 1
- pygls.features no longer exists HOT 2
- Error on Ubuntu 16.04 with Python 3.5 HOT 1
- New Files not being added to the Project
- Verilog/System Verilog support in Emacs lsp-mode HOT 2
- NeoVim Native LSP Configuration errors HOT 2
- [Doc] Use pip3 instead of pip in instructions HOT 1
- No compiler flags applied even though hdl_checker.config exists
- hdl_checker appears as not running HOT 1
- Remove typing dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hdl_checker.