Writing a Verilog autoformat extension for Sublime/VS Code - verilog

As an RTL developer, I find it annoying that my favorite text editors (Notepad++, Sublime, VS Code) don't have autoformat options for RTL languages like Verilog and VHDL. So I took it upon myself to create one.
I want to develop an auto-format extension for one of those editors. I dropped Notepad++ because it doesn't have native support for Linux and macOS.
So, the question is: how to get started in developing an auto-format extension for a language for Sublime and VS Code?
Notes:
I don't intend to develop an extension for both editors but I'd want to see which would be more feasible.
With Verilog being closer to C syntax, it might be easier to start there (and I also prefer it over VHDL, but let's not get into religious discussions)
I know that Emacs and Sigasi editors provide auto-format options for RTL languages but their format options are strict and I don't like the outcome, hence I intend to make the formatting style configurable
I ran into this work https://github.com/thomasrussellmurphy/istyle-verilog-formatter it might be useful to build on it if possible

I don't intend to develop an extension for both editors but I'd want to see which would be more feasible.
In my opinion, I would prefer coding RTL languages in VS code because it's more versatile than sublime text as in free beer and speech. I would highly recommend beginning from here https://code.visualstudio.com/docs/extensions/example-hello-world.
Oh, you also need to know Typescript / Javascript to write an extension.
I ran into this work https://github.com/thomasrussellmurphy/istyle-verilog-formatter it might be useful to build on it if possible
I am excited to see the port of this to VS Code/ Sublime Text. I am sorry I don't know how to work on from C++ to TypeScript. My guess would be to copy the implementation method and write in TypeScript.
From their website :
Prerequisites:
You need Node.js installed and available in your $PATH. Node.js includes npm, the Node.js Package Manager, which will be used to install the extension generator.
I am pretty excited to see auto formatting extensions for Verilog. I hope i can contribute too :)
Edit :
I found this https://github.com/g2384/VHDLFormatter written in TypeScript. The transition to VSCode/Sublime would be easier than the above in C++. I have tested it personally and it works awesome! Hope it helps :)

Related

"Jump to definition" in Rust

After years of coding in modern IDEs (Visual Studio, Xcode, JetBrain's products) I'm quite used to invaluable Jump to definition feature. It is especially invaluable for system libraries and frameworks when you yet learning the core features of the new language.
Is there any way to achieve the same functionality for the Rust combined with any modern IDE or text editor? Any vim, sublime text plugin?
IDE support for Rust is not there yet. There exists at least the Racer project, that provides a jump-to-definition feature among other things.
Racer is intended to be integrated into any IDE/text editor, and ships with an emacs integration.
In Vim and emacs you can use ctags to get you a lot of the way there; the language definitions are in src/etc/ctags.rust and you can produce tags for the Rust distribution with make TAGS.vi (or make TAGS.emacs for emacs’ format). See mk/ctags.mk for more information.
For setting them up and using them in Vim, see :help tags.
There is a project called rusty-tags generating ctags for Rust. At the time of this post, it is still actively maintained.
The RustDT IDE now supports Open Definition functionality, using the Racer tool.
Sublime's RustAutoComplete has a working Go to Definition using a separately installed Racer.
I'm using it and it works.
That being said, in 2014 the language is still in a flux and the Racer functionality is still limited.
I currenly have "auto_complete": false and only use the completion manually (with a keyboard shortcut) in order to avoid some Racer crashes.
Emacs can be integrated with rust-analyzer via lsp-mode. This will allow you to navigate the source code using Rust's type system. I describe a detailed setup in the code navigation section of my Rust with Emacs guide.
dumb-jump works well for rust.

Vim code debugger suggestions (step through etc)

I'm a fairly new web developer, doing most of my work in JavaScript / CSS, but I will be doing work in PHP soon and I wanted to get a head start on debugging software.
My editor of choice is Vim, so I'm looking for suggestions for a debugger workflow, either a Vim plugin or a separate program, preferably something that could match the feature set of Eclipse or Visual Studio, but if that doesn't exist I'd like to know.
I found several Vim plugins online:
- VimDebug looks nice but only supports Python, Perl and Ruby.
- vdb looks promising but also confusing (at least to me)
- VimDebugger is in early stages
I also found gdb, which was the only non-IDE debugging tool I found (if anyone has found others I'd love to hear about them!), as well as vim-debug, although development seems to have stalled on that one.
In short, does anyone have any working experience with the above tools? Or have a better suggestion? Does anyone have a working workflow debugging code with Vim?
Thanks so much in advance!
There is also the relatively new and actively developed Vdebug:
https://github.com/joonty/vdebug
It talks to debuggers supporting the DBGp protocol (which includes PHP with Xdebug and also many other dynamic languages).

Build OS-independent notepad with some code completion - appropriate platform?

I want to build as simple notepad application with some code-completion.
It should be easy to compile to Linux, OS X and Windows.
I'm looking at wx-widgets or GTK. Others?? (as web-service as worst case.),
and without library dependencies.
Or does there exist any OS-independent FOSS editor with plug-in functionality.
(Eclipse way to heavy).
To be specific, what I want is a "helper" when coding XML towards an application-framework that use XML extensively. As libraries are loaded (through XML) new tags should be allowed and their existence should be prompted to user, both in toolbar (tags) and auto-complete (attributes).
Recommendations?
regards,
//t
XML Copy Editor: I've used it and it's not the best editor, but it does do the autocompletion.
Conglomerate: Looks quite promising but I never got it to work when I tried it out a year ago. Perhaps it's improved since then.
As for an OS-independent FOSS editor with plugin functionality that is more lightweight than Eclipse, try Gedit. It's not too difficult to write plugins for whatever functionality you may need. It's based on GTK.

VIM: More precise C/C++ code parsing solutions?

Pre:
I've been working in VIM for like a year already. Lots of great things: combinations, scripts. Whenever I'm editing something in a different editor, I feel sluggish/uncomfortable without VIM's navigation.
The problem:
The thing that really bothers me most of all is source code navigation using existing tools (ctags, cscope). Often, ctags can't find the declaration of a variable, cscope as opposed to ctags finds all definitions with the same variable name. Same craziness with call tree navigation, finding forward declarations along with a single class definition etc.
Compared to MS Intellisense, Visual Assist or even source code navigation in Eclipse, Exuberant Tags/cscope seems to be deprecated for at least 10 years.
I know there are tools like ViEMU, but they don't really solve the problem, since you lose lots of VIM's functionality.
The question:
I was wondering if there is a tool that does the source parsing better, or there is some way to integrate source parsing engines like Intellisense into VIM ?
Maybe there are commercial solutions or there are people who are ready to implement one ?
All the benefits of VIM seem to save less time than is being wasted while navigating to class definition, compared to Visual Assist, where it's done by a single Alt-G shortcut.
Search and Call tree
You could try eclim, which is a way to use some Eclipse features in Vim.
For C/C++, it provides :
Context sensitive completion (although it is disabled on Windows because it is buggy)
Context sensitive search in Project files (through :CSearchContext)
Call tree for functions/methods (:CCallHierarchy)
Code Validation (:Validate)
It is not great, but it can help in some cases.
Code Completion
Regarding automatic code completion, I primarily use OmniCppComplete, which is using tags to provide Context aware code completion. It is not that bad.
As advised by Luc Hermitte, you can also use clang_complete which does not need ctags, but needs clang installed.
Unfortunatelly, it is a real problem. ctags or cscope can hardly compete with Visual Studio code browsing - it actually uses a C++ compiler front-end to parse the code for the editor.

A Linux tool that will display errors as I type, Visual Studio style

I'm looking a tool that will display details of syntax errors in my code as I'm typing it, in the same way that Visual Studio does. I'm currently using Gedit, but am not adverse to acquiring a new text editor. I'm using C++ and HTML/CSS right now, but will be branching out to more languages in the future, so it needs to have support for as many languages as possible. I'd also like to avoid using an IDE as I feel more productive using a text editor and the GNU toolchain. Any suggestions?
You will likely have difficulty finding a simple one-file editor that can do this. An IDE is virtually a necessity, since it integrates with a compiler to detect errors/warnings.
If you use an IDE (and I would recommend Eclipse or maybe KDevelop), you can continue to use the GNU toolchain; you don't need to build your project from the IDE if you don't want to. I regularly use Eclipse for programming and then Ant or Make in a terminal for building.
How about Eclipse?
vim does syntax highlighting well. As far as I know, however, it doesn't have the ability to display the details of the syntax errors in the editor. The constant "hands on keyboard" does speed up programming, though.
vim with the pyflakes plugin does this for python, but I don't know about other languages.

Resources