I am studying economics so I have not much experience in programming. I really would like to make Julia work on Visual Studio Code but I've been unsuccessful.
So I downloaded the Julia extension but I don't know how to define the settings. Do I need to create a launch.json file or any other file to make it work?
I think that somebody asked a similar question previously at "How to setup Julia in VS code?"
but the answer didn't really help me.
Thank you all for your help.
First you need to install Julia on your Mac by downloading the julia dmg file from here. This puts an application in the Applications folder.
There are several ways to set things up so julia will run from command line. I used the following:
ln -fs "/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia" /usr/local/bin/julia
This should work if the name of your application, that you just installed, is julia-0.6.app
After running the above command, you should be able to type Julia on the command line and have it to start.
You can now create a Julia script and place it in the directory you're running from. I created a file named julia_test001.jl It contained the following:
for i in 1:5
print(i, ", ")
end
This is a very short Julia script I wrote for testing.
Now start VScode and install the Julia language support extension. After that has loaded, open the file Julia_test001.jl. Once this file is opened, click the triangle in the upper right corner or open the command palette and select the option: run code. The julia_test001.jl should run and print the result 1,2,3,4,5.
Related
The message:
Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary.
Pops up when trying to install run Julia in vscode on my Mac. I tried
Macintosh HD/Applications/Julia-1.7.app
But this didn't work and gives the same error
So after messing around some more it seems that you have to go all the way to the inner executable to get it to work.
I wanted to post the answer in case anyone else has this problem in the future.
Solution:
Right click on the julia application in finder and click 'Show package contents' from there this is the overall path i used as the vscode julia path:
/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia
There are several questions here on indenting code in visual studio code (How do you format code in Visual Studio Code (VSCode)?), and on indenting OCaml code (How to indent existing OCaml code), but none of the answers work for indenting OCaml code in visual studio code.
I have installed the OCaml Platform visual studio code extension, vscode-ocaml-format (following https://dev.realworldocaml.org/install.html), ocaml-lsp-server (following https://ocaml.org/learn/tutorials/up_and_running.html) using opam, updated and upgraded everything, used eval $(opam env), but this still does not work. I'm a bit at a loss...
It is very hard to answer such questions as we need more debugging input from your side. On the other hand, it is so hard to get it from vscode so it is better just to walk you through the whole process from the very beginning to see where things might go wrong. I would suggest you follow the process for ease of debugging. After you have everything working you can adapt it to your particular setup.
Create a fresh new folder and put some OCaml file into it, let's name it test.ml and let's put into it the following code,
let test = [
"hello"
]
Now create a fresh local opam switch, by issuing in the same folder as the test.ml file the following command, (note the dot at the end of the command, it is required, it will create a local switch for you)
opam switch create .
Next install the required dependencies.
opam install ocamlformat ocamlformat-rpc ocaml-lsp-server
Create the .ocamlformat file in the same folder as the test.ml file. It will tell ocamlformat that you want to be ocamlformatted and you can use this file to setup your preferences.
Make sure that you have installed ocamlplatform for vscode
Now we are ready for the test. Start vscode and open test.ml. It will ask you to select the sandbox. Select the sandbox that corresponds to the folder where you put test.ml (it should be marked as local and have the same name as the folder name, and there will be the full path to it, so it will be easy for you to find it). The code syntax should be highlighted and there should be no error messages from vscode. Finally, hit Ctrl-Shift-I to re-indent your file, it should transform your code to,
let test = [ "hello" ]
I am not able to figure out how to run MATLAB (.m) code in VSCode.
I have installed the MATLAB Extension for VSCode and added the path for the mlint file for MATLAB as stated in the extension.
"matlab.mlintpath"
VSCode identifies the file as a MATLAB file. However, the code won't run.
How can I run MATLAB code from within VSCode?
There is a way, this VSCode extension suggests that you can use it to run MATLAB code from within VSCode without having to open the MATLAB GUI. It does not invalidate the below though; you need to have a working, licensed MATLAB installation, which will be called in the background. Without a working, licensed MATLAB installation you cannot run MATLAB code.
As MATLAB is proprietary, there are only two ways to run MATLAB code: by running the code from the MATLAB IDE (with a valid license of course), or by compiling it to an executable file with the MATLAB compiler.
You might be able to get other IDEs to have syntax highlighting and typing-hints like MATLAB's own IDE through importing its mlint functionality, like you did, but that won't execute the code.
Thus no, you cannot execute MATLAB code directly within VSCode, you can only covertly call the MATLAB engine from inside VSCode.
A possible workaround would be to export your MATLAB code to C/C++ using the MATLAB Coder. You can then run the C/C++ code from within VSCode.
TL;DR:
I wrote Matlab Terminal Extension for VS Code on Linux. It can run matlab files and spawn a matlab-Terminal. You can find the repo here.
MatTer for VS Code
I recently wanted to used a matlab terminal in vscode. There even is an extension for this. But while using the extension I faced some flaws. Also the repository does not seem to be active anymore and the owner doesn't react to issues and similar.
So I decided to write my own first extension MatTer for VS Code and published it to the VS marketplace. It's in early Development, but it can already spawn a matlab-Terminal and run matlab files.
The repo is hosted on Github, see here: https://github.com/mauzigoe/matter-for-vscode
To install it via vscode just search for matter-for-vscode in Extension.
Critics and Feedback is welcomed, esp. since I'm new to this.
"#Liam the long discourse is necessary, because having the extension without a valid MATLAB license+installation won't work.T"
...because at some point you need at least ONE working matlab install just to develop the m-file :)
I suspect that you're right, and it comes down to a choice between embedding "foreign" code into an m-file, or making calls to the matlab engine from within a foreign IDE. They do have a free RTE but you still need some form of Matlab IDE to write in plus the Matlab Compiler toolbox to build the project out for the RTE.
The work-around is to use OS tools to remove Matlab and other proprietary tools from the loop entirely. That is why if you're going to be forced to pay $5k for a proprietary tool, it has to be justified in other ways than "it can get the job done".
VS Code extensions have the same problem as any other extension: if you look at the repository and see what is required to install and run the extension? You'll probably never install an extension again. It's about as wise as blithely downloading and installing any code from the Internet: it's no better than the source. I would wait until you figure-out how to call getOpen() etc within VS Code without downloading some random extension from some random source especially one that hasn't been updated in the past 2 years. Or at least use VS2019 Community:
https://www.mathworks.com/matlabcentral/answers/100603-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-9-0-or-10-0
you could use the "Matlab Interactive Terminal" Extention, the link is below.
To use it, you need to follow the instruction to install a "MATLAB Engine API for Python" and you are good to go (and you need a working Matlab).
after installing the extension, you could open the Matlab terminal in the command window (by pressing Ctrl+Shift+P and input "Open a Matlab Terminal"), and you could get the same Matlab terminal as in the real Matlab IDE, and now you could run .m code in Vscode.
You can use the Code Runner extension and put this line in your settings.json:
"code-runner.executorMapByFileExtension": {
".m": "cd $dir && matlab -batch \"$fileNameWithoutExt\""
}
You would probably also want to install the MATLAB extension.
I am realizing the hardest part in learning to code is knowing how to even ask the right questions..
ill try and word it as best i can. I also will attach a screenshot.
I am running code in the terminal through VS code... and there is just so many files being shown every time i run the code. There is white and blue text that seems like the same thing? It makes it hard for me to see whats going on. Is there anyway to shorten or completely remove it? it seems 100% useless for just running some basic code.
The
C:/Program Files (x86)/Microsoft Visual Studio/shared/python37_64/python.exe
Is the Absolute path of the python executable.
And the
C:/PythonProjects/vscode/...../helloworld_start.py
Is the absolute path of the file that you are running.
Simple it is running
python helloworld_start.py
If you want to reduce this. You can simply open a terminal and change the directory to the current working directory and simply run the above command. This will use the relative path to run the helloworld_start.py file
First you need to add python to the Environment variables and then Open the terminal uin VSCode using Ctrl + ` and then cd to the current working directory and run python helloworld_test.py
I am using the plugin "plugin builder" to generate a template. The plugin builder is also generating a make file. I am working on a computer using windows 7 and am trying to execute the make file using the command line of Windows (MS Dos). However, this doesen't work. This means that my *.ui and my *.qrc file are not compiled to python, if I understand correctly.
What can I do? I am not very familiar with pc or programming so I hope to finde someone who can give me an easy understandable answer. Thank you.
Run the code in the osgeo4w Shell
And follow the steps in here:
http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html
If the osgeo4w shell doesn't work copy the qtcore4.dll and qtgui4.dll to the windows system directory first
Regards
'make', works in linux by default as it is part of its build system. For windows, you could try downloading GNU Make Setup from below link
GNU make link
afterwards, you should be able to run 'make' from your dos prompt