Comments (6)
The difficult part is keeping the comments when formatting. For example you could have a comment between 'if' and 'then' so there are a lot of cases to consider. Maybe the solution is to keep the 'if' and 'then' tokens in the AST and associate leading and trailing comments to them. There was support added to associate leading and trailing comments with tokens.
-- leading
if -- trailing
Regarding spacing I should be normalized when formatting the AST anyway so the original spacing is irrelevant. If the original spacing is of interest it can be taken from the positional information if you do not care about tab vs spaces.
from rust_hdl.
Actually, AST with comments is not an AST anymore, if we want to be accurate. In such case another scenario is to create CST to be used for formatting and language server, and create AST from CST, if someone ever needs pure AST.
from rust_hdl.
Sure I might have misused the term AST. I have not attached any meaning to the name other than being the data structure for the syntax tree. CST might be a more accurate terminology.
from rust_hdl.
from rust_hdl.
@kraigher one more remark about indentation when generating VHDL from syntax tree. It looks like right now it is also not easy, as nodes for different blocks (for example for While loop) does not hold information about the SrcPos of whole block. I can see 2 possible solutions. Add SrcPos
for such blocks or add elsif|else|end|begin
tokens to the syntax tree. What do you think, maybe you have already had better idea?
from rust_hdl.
Yes those tokens need to be added to the CST to know the position. But as I said in the previous comment they need to added also since they may have leading and trailing comments.
from rust_hdl.
Related Issues (20)
- [Feature] Add support to environment variable usage in the vhdl_ls.toml
- Add support for Xilinx xci files HOT 3
- vhdl_lang panic on certain simple inputs.
- [Bug] Typo in error message
- [Bug] Encryption envelopes flagging many errors despite being valid VHDL HOT 3
- 'Duplicate Declaration' message when instantiated components are in different blocks
- Does not appear to support genericized packages HOT 4
- [Bug] Errors reported when using consecutively following attributes
- VHDL-LS misses length comparision HOT 1
- [Question] How to define multiple distinct projects in the same worksapce root? HOT 2
- [BUG] Errors reported when using generic types and generic packages HOT 1
- [Feature] Add option to mute the error and/or disable lint checking HOT 6
- Emacs strange Unexpected EOF HOT 2
- Emacs getting stderr when restarting workspace
- [Feature Request] Support custom user-defined types/subtypes HOT 1
- aggregate as target does not flag when the same elements are assigned
- Don't allow declarations where they are not allowed
- Feature request: expose tokenizer in public API HOT 1
- [Enhancement] Associate high level syntax elements with their respective tokens HOT 5
- Avoid sending diagnostics for all files on every change HOT 2
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 rust_hdl.