Using Sublime 2 for Haskell Development? - haskell

What is the current status of Sublime 2 integration for Haskell? I see two possible packages so far. A plugin for code highlighting and a REPL plugin.
Is there an intelli-sense plugin for Haskell?
Maybe integration with Hackage as well?
Thanks.

SublimeHaskell plugin is the modern choice for Haskell development with SublimeText. It is well maintained and has plenty of useful features.
Other quite useful plugins:
Shell Turtlestein, which allows you to quickly type in shell commands under a single keystroke from inside the editor.
SublimeREPL, which allows you to run GHCi from inside the editor. Though without support for cabal repl yet.
SideBarEnhancements, which I primarily use to rename/move files without touching the mouse. With it you can hit Ctrl/Cmd + P and type "rename" or "move" to enter the dialogue.

I use Sublime exclusively at the moment and while it's not all that special out of the box, installing sublime-text-haskell as Cubic suggested makes it a little better (it will compile and highlight errors when you save a file and apparently enhances the auto-completion).
I've experimented with writing my own plugins but the reality is that a lot of really cool possibilities are made difficult to implement because the API is actually kind of restricting (there's no way to add extra information like type signatures to auto-complete options for example).
It seems that the dev(s) are working on adding some requested API features, but until then, sublime-text-haskell is probably the best Haskell plugin.

Related

Is it possible to use VSCode language-server-protocol engine along with the Vim or NeoVim?

I have tried different code-analysis engines and tools (like tern_for_vim) for Vim, but they do not provide such a great autocompletion, goto and rename functionality as in VSCode.
As I know VSCode uses language-server-protocol technology to provide IDE functionality. So here is my question:
Is it possible to use VSCode language-server-protocol engine inside the Vim or NeoVim? In other words, it is possible to provide the same good quality of IDE-like functionality as VSCode do?
I have tried javascript-typescript-langserver with deoplete.vim, but the quality of autocompletion and goto-declaration was bad.
Yes, you can use it via coc.nvim installing which is a fork of VSCode. You then apply one of its packages for a specific language eg coc-python.
This is the installation guide for coc.nvim. You then need to install the language package with this command in (Neo)Vim:
:CocInstall coc-python
You can then use the default VS Code completion engine immediately (jedi) or upgrade to what will become its successor, MSPLS:
For MSPLS run the command :CocConfig and enter this in to the file which is opened:
{
"python.jediEnabled": false
}
Then run :CocRestart
There are other other engines like coc.nvim such as YouCompleteMe. They all have small variations / tailoring for specific languages.
In theory, yes. http://langserver.org/ provides a list of editor plugins and language server implementations.
With packages like https://github.com/autozimu/LanguageClient-neovim (which is for neovim, there are others for both vim and neovim) you can use language servers in neovim.
However, some implementations are tied to the way it works within vscode (like haxe lsp), so it may be a little hard to get it working. Javascript should be better integrated, but I didn't try it myself.

"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.

Vi / Vim for project of more than a few files

I typically use an ide for large projects and vi for small single file scripts temporary files etc.
Lately I have heard of people using vi for larger projects too - actually, quite defensive and particular proud to do so.
I have tried, but i found it very cumbersome. Do any other programmers here use vi for and medium - large projects? If so, are there any tips/tricks you can offer for navigating source, looking at multiple files etc?
I have tried using tmux to see if it made things easier - but it still felt quite cumbersome
There is no magical tool that can make everything perfect. Vim is an editor, and it's pretty good at it, but it's not and will never be an IDE.
There used to be the pida project that made an IDE around vim, for better interaction when using python, but it got abandonned.
There is eclim which is a really neat tool that can use eclipse as a backend IDE accessible in a few keystrokes from within vim, while having all the power of eclipse for tagging, refactoring, debugging etc.. But you have to want running eclipse in background, which is like hiding an elephant under the carpet...
There are many little plugins you may want to use, and I'm pretty sure everyone has his favorite set of plugins, that helps navigate easily in the code and help tagging (like fugitive, nerdtree, etc..)
Finally, there is vim, a shell and that's all. Vim does a lot of things correctly, like navigating in the source, launching compilations and parsing the errors etc.. And for what vim is not good at, you can use your shell, to execute, to do git stuff, to open more vim windows to edit code..
Anyway, there's no perfect answer to your question, and I bet your question will be closed because of being "non constructive".
What do you find cumbersome? What works for you? What doesn't? What kind of feature do you need to be able to work efficiently with multiple files? How many are multiple files anyway?
Some people use Vim for working on quite large projects: the Linux kernel, Firefox, Vim itself… I guess that you need to know Vim pretty well to pull that off but it's all very doable, even without many plugins.
But I tend to think "complexity" rather than "quantity".
When I work with "complex" languages+projects (quotes because it is all very subjective) I'll use a more suited IDE with a Vim-emulation plugin: Flash Builder+Vrapper for Actionscript 3, Eclipse+Vrapper (then) Android Studio+IdeaVim (now) for Android.
When I work with "simple" (quotes, again) languages+projects I'll use Vim: that's any project involving HTML/CSS/JavaScript/PHP, from 3 to 50+ files.
File/buffer navigation
Vim is very good at opening files (which sounds funny), even without plugins. :sp **/foo<Tab>, for example, is quick and easy. :Ex foo/bar as well.
Switching buffers is also very easy, if a bit awkward at first. :bn, :bN and :b <Tab> will get you a long way.
And if you don't like those built-in methods, you can create your own cool mappings or choose from many plugins.
"Semantic" navigation
I like to think about my project in class/method names rather than in file names. With an up-to-date tags file (generated with ctags or some compatible program), :tag foo is a very efficient way to move around, <C-]> jumps to the definition of the tag under the cursor and <C-w>} opens that definition in a small preview window. That's more than enough for my needs.
I don't particularly like them but you can also use TagBar or TagList to have something that resembles the class browser of your IDE.
I'd suggest you make your needs more clear and ask more specific questions or look around on SO. The subjects above are pretty well covered.
Just a few pointers: I like NERDTree and CtrlP for easy/powerful file navigation and splits for keeping several files visable and navigatable at the same time.

VIM as an IDE - Suggestions

I am looking for recommendations on using VIM as an IDE. I generally code in a number of programming languages, including C, C++, assembler, MATLAB, Maple, BASH scripts, to name a few.
In general, I like to use a single IDE for the bulk of my projects for the sake of consistency, and I have found that I perform about 90% of all my coding in VIM, and occasionally use Eclipse instead for certain projects in C/C++ (ie: projects people have already put together as an Eclipse project, or PIC24/32 projects from www.microchip.com).
I am already very familiar with the basic functionality of VIM (windows vs buffers, text manipulation, scripting), and would like to use it as my primary IDE. I have already taken a few tips from here:
http://vim.wikia.com/wiki/Use_Vim_like_an_IDE#Writing_Code
I already use the nerdTree plugin for directory browsing in a project, etc, but I need to do something about code completion and symbol resolution, as those are my two greatest concerns.
Symbol resolution
I have some limited experience in the use of C-tags, and wanted a suggestion on what I should use if I am working with a VERY large code-base that changes frequently. The projects I work on typically are pulling in header files from at least a dozen other projects, and I would like to be able to jump to the file where a function, constant, or macro is defined quickly (ie: like the CTRL-G feature in Eclipse, "jump to definition"), as well as rapidly get a list of all calls/references to a function/macro/constant/etc (ie: like the CTRL-SHIFT-G feature in Eclipse, "Show all references in project or current working directory").
Tab completion
One of the features I really like in Visual Studio and Eclipse, for example, is when I type in a variable name (ie: pointer to struct) and it resolves the names and types of all structure members and gives me a tab completion list to choose the appropriate member. They also point out when I've incorrectly used "." vs "->" for member access. I've tried superTab in VIM, but I just couldn't get it working. I also want the tab-completion feature to use the same C-tags as generated by the symbol resolution plugin
Handling build output
The final concern of mine is having an auto-generated list of build warnings and build errors. When I, for example, just run "make all" at the command-line prompt, it is a pain to have to read through code listings to manually find all build warnings.
I realize this is a lot to ask, and that I could always just fall-back to Visual Studio or Eclipse, but I really want just a simple cross-platform console-capable modal editor for all my development needs, and none of the major IDE's out there fill this need.
Thank you all in advance.
http://eclim.org/ - bring Eclipse functionality to the Vim editor
https://github.com/scrooloose/syntastic - syntax checker warnings in quickfix list
I think (but haven't checked) that Eclim satisfies #1 and #2 while I'm sure that Syntastic satisfies #3. More things of interest:
https://github.com/Lokaltog/vim-powerline - just nice
https://github.com/kien/ctrlp.vim - quick file finder
https://github.com/tpope/vim-pathogen - plugin manager (to install the others)
And are you aware of omnicompletion via Ctrl-p and Ctrl-n (prev and next) in insert mode? That's not code completion, but frequently does the job.
For the auto-completion part (point 2), I am proficiently using clang_complete.
For a quick setup and reference, try this page: http://zwiener.org/vimautocomplete.html
EDIT: this is for C, C++ and Objective-C only.
I use the following configuration in vim:
zipped file
It has autocomplete based on tag list, ctags, nerd commenter and some more plugins.
Hope it helps.. :)
I have been using Vim as an IDE for about a year now. All of my customization is online at github.
That said, I don't think a Vim beginner should start using vim like this; rather I think the Vim beginner should learn vim incrementally. The only changes that I think are so essential I would make them from the very beginning are:
Remap ESC to jk
Switch : and ;
Set leader key to ,

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.

Resources