Scala with VScode - scala

I started to use vscode for python development. And I really like it, does anyone know how to extend VScode so I can write scala in it as well ?
At the bare minimum I need to get syntax highlighting working.

Scala works well in VS Code 2019.
There's official syntax highlighting, and a Language Server called Metals (which replaces Ensime which is mentioned in other answers).

There is one here:
https://github.com/IliyaTryapitsin/vscode-scala
You can add it by reading the readme there which is:
Run VSCode
code --enableExtensionGallery
Press F1 then input:
for scala installation
ext install scala
for sbt installation
ext install sbt
for snippets installation
ext install scalasnippets

If your NOT using Intellij or Eclipse and want to stick to VSCode, then I highly recommend Ensime & Ensime plugin below:
https://marketplace.visualstudio.com/items?itemName=dragos.scala-lsp
Also check out, www.ensime.org
It's a bit more involved to setup ensime env but still worth it.
Discussion of two is below here:
https://www.reddit.com/r/scala/comments/5eu9if/intellij_vs_ensime/
However, Intellij has improved a lot. So, the beauty contest is a matter of judgement call.
I have been switch back & forth between many variations (Emacs, Intellij, neovim, VSCode). It's a complicated language. So, I need all the help I can get!

If you dig into the applications path it looks to me to be extensible in .js, take a look at the javascript and typescript folders for example(though I haven't tried it yet)

Visual Studio Code does not have a language extensible story yet, but it could be coming soon.
https://code.visualstudio.com/Docs/languages#_common-questions

scala has official vs code scala extension

Related

Autocomplete in Neovim for Scala

I am using Neovim v0.7.2 and I am looking for a way to have autocomplete for my Neovim. Since it's suggested that we should use Metals for Scala in Neovim. After installing it, I could use its features but it seems does not support autocomplete as Intellij IDEA does. Any suggestions/recommendations for me or do I miss any part when configuring Metals with Neovim? Thank you!
SOLVED: I found the problem and post the answer below. In short, follow the example in https://github.com/scalameta/nvim-metals/discussions/39
I miss the installation of nvim-cmp. The example in https://github.com/scalameta/nvim-metals/discussions/39 works perfectly.

how to do map dependencies with code maps using VS code on ubuntu?

I encountered this link: https://learn.microsoft.com/en-us/visualstudio/modeling/map-dependencies-across-your-solutions?view=vs-2019, and I was thinking to follow it to generate code maps for my c++ code running on ubuntu vs code of version 1.61.2. Somehow I can not even find the tool menu and the solution explorer. I managed to install the solution explorer as my VS code extension. But I still do not know how to get started. Any comments are greatly appreciated.
Unfortunately it seems that the dependency maps are only available in Visual Studio and not in VSCode, which are two separate things

Why do no programs run in visual studio code?

I recently got a new computer and reinstalled visual studio code but I haven't been able to run any of my files. The error has occurred with both python and C++, so I feel as though it is the IDE that is the problem. I have looked online and there are no straight answers as I have tried following some solutions which have resulted in different errors.
The error above comes up when I run (F5) a simple line of code in c++. Does anyone have a solution?
Thanks, Jacob
[EDIT]
For my python files to work I have to manually select 'Python: current file' but for c++ files they still have the same error.
First step, uninstall python from this machine.
Second, reinstall and make sure that you check the box "add to path".
It's pretty easy to miss as it's a small box, and I missed it my first time installing python earlier in the year. Here's the box you may have missed while installing.
It could be your extensions.
I had a similar error message and simply updated all of my extensions and then my SDK. I was then able to run my code within the IDE. I was using VSCode for c++ and also updated my GCC compiler along with the extensions.
Also look into your computer's environment variables, if you have changed the %PATH variables it may be affecting your ability to run/compile programs.

How to configure Visual Studio Code to build a project with IAR compiler?

I want to use Visual Studio Code as my main IDE, but I want to compile my code with IAR's compiler.
How could I configure VSCode ?
I found this extension but the documentation is too poor.
Yes, the extension politoleo.iar is indeed NOT good.
-> I found a better one (will try it in future by myself):
VSCode plugin: pluyckx.iar-vsc
IAR For Visual Studio Code - Visual Studio Marketplace
Good document
Welcome to IAR-VSC’s documentation! — IAR-VSC 1.2 documentation
doc's Github source: pluyckx/iar-vsc
IAR related official Technical Note
Using Visual Studio Code with IAR Embedded Workbench
Enjoy it !
There are now two official IAR plugins for VSCode which make things much easier:
For building and development: https://marketplace.visualstudio.com/items?itemName=iarsystems.iar-build
For debugging with C-Spy: https://marketplace.visualstudio.com/items?itemName=iarsystems.iar-debug
https://www.iar.com/knowledge/support/technical-notes/general/using-visual-studio-code-with-iar-embedded-workbench/
What I did is setting some environment variables in settings.json;
then in tasks.json I created shell tasks that call the IarBuild.exe & IarIdePm.exe with appropriate values (see the documentation on the command line options)...
So now, I can use VSCode for navigation & editing, but the compilation is done by the EWARM.
The only thing that I haven't figure out yet is how to make C-Spy work from within VSCode...
Currently when I want to debug, I just launch the EWARM and debug from there...
here is a screenshot:Screenshot of settings.json and tasks.json
For this, you can port you project to the custom build system (non iarbuild), e.g. a best choose is the Qbs. The Qbs support a lot of architectures and the toolchains (include IAR, KEIL and so on). In this case you can then use any IDE which support the Qbs, e.g. such as VSCode or QtCreator, and to open your project in any of these IDEs.
Both IDEs support only the GDB debugging, because the C-Spy debuger is a proptietary technology, which has not the public datasheets.

Elpy to allow pyenv to work on a project basis

I've used Emacs for all my coding projects so far. Soon I will start some python projects for the first time and would love to stick to Emacs for these as well.
I was looking into elpy which seems to provide already alot of desired functionality. The part I was not able to figure out completely is the following. I like to define virtual environments and python version to be used on a project basis. Let's say I start a project A, then I would use pyenv-virtualenv or pyenv-virtualenvwrapper to set it up
pyenv virtualenv 3.4.2 my-virtual-env-3.4.2
by doing this I've linked the python version 3.4.2 to that specific virtualenv / project. I have two questions regarding this in combination with elpy.
Question: This is a rather basic one. All the above can be achieved via the terminal. What is the advantage to emacs to support this? The workflow for me would be: Create project with associated virtualenv and python version. Activate virtualenv and start coding in emacs. If I need to install a package I will run pip in the terminal to ensure virtualenv is captured properly. There must be a reason why it's beneficial to support this in emacs. With my lack of knowledge I just don't see it :)
As pointed out there is for sure a good reason why we want emacs / elpy to support this. My second question would then be
**Question: How can I achieve this in emacs? Lokks like this blog has a solution. I was wondeirng if someone already tried this setup if it is a neat solution with makes sense conceptually. **
Well I strongly guess the goal is to use more features than just syntax highlighting: flycheck/flake8/linting, refactoring, elpy's test runner to use the right python version, install a pip package directly from emacs, stuff like this. You can carry on doing this in the terminal, but once you want an emacs feature, you'll need to set it up.
I found two modes to do that (see wikemacs python page and doubled-checked on melpa): pyenv-mode (in melpa) and pyenv-mode-auto (change the version when there is a .python-version file).