How to add Lua libraries into a project and use "require" in Visual Studio Code - visual-studio-code

I am quite new to Lua and couldn't information as to how to add Lua libraries into a project and use "require" in Visual Studio Code

You can define your package.path and package.cpath in your launch.json file for the project.
your configuration would look something like this:
"configurations": [
{
"type": "lua",
"request": "launch",
"name": "Debug",
"program": "${workspaceFolder}/test.lua",
"path": "${workspaceFolder}/?.lua;C:\\lua\\?.lua"
}
]
how these variable work with require is explained in
Programming in Lua: 8.1 – The require Function

Related

Problem adding boost:serialization libraries to Visual Studio Code

I am trying to use boost::serialization libraries in Visual Studio, but I am facing some problem when I add this libs to my project. I have build the boost::serialization libraries giving as output the different variants. I am using g++ compiler support for Windows (sys64\mingw64\bin\g++.exe). Gcc version is 11.2.0. Here is the project-config.jam file:
# Boost.Build Configuration
# Automatically generated by bootstrap.bat
import option ;
using gcc : 11.2.0 : C:\\msys64\\mingw64\\bin\\g++.exe ;
option.set keep-going : false ;
The I have build the libraries through:
b2 toolset=gcc --with-serialization --build-type=complete stage
This is my task.json file:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-I",
"C:\\Users\\user_name\\Training\\Udemy Modern C++\\Utilities\\boost_1_78_0",
"-L",
"C:\\Users\\user_name\\Training\\Udemy Modern C++\\Utilities\\boost_1_78_0\\bin.v2\\libs",
"-llibboost_serialization-mgw11-mt-s-x64-1_78.a"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: C:\\msys64\\mingw64\\bin\\g++.exe"
but when I try to compile my cpp file I obtain next error:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\FERNAN~1.GUT\AppData\Local\Temp\3\cc3WuxhU.o: in function `boost::archive::text_oarchive::text_oarchive(std::ostream&, unsigned int)':
C:/Users/fernando.gutierrez/Training/Udemy Modern C++/Utilities/boost_1_78_0/boost/archive/text_oarchive.hpp:104: undefined reference to `boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::ostream&, unsigned int)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/fernando.gutierrez/Training/Udemy Modern C++/Utilities/boost_1_78_0/boost/archive/text_oarchive.hpp:107: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::init()'
The code is a simple code example of use of serialization.
I have tried adding all the different variants of the serialization library without success. Has anyone any idea on what is going on? I am new on using boost, so maybe it is a not completely well formulated question.
Thank you in advance.

How to set up tasks.json file in VSCODE to compile Fortran programs?

I want to set up VScode (OS: Windows 10) to create and then compile programs written in Fortran 90/95. I can do this by typing in the terminal : gfortran -o Example_exe Example.f90 and then ./Example_exe. I don't want to have to write these lines every time, so I tried to set up my tasks.json file to automate a build routine using gfortran as compiler.
I found this tutorial : https://titanwolf.org/Network/Articles/Article?AID=360e0bde-0507-4de4-960c-2eae8fa8c782#gsc.tab=0 but the tasks.json file given is unclear.
Can I have a tasks.json file setup to automate my build routine please ?
I have installed the following extensions : Modern Fortran, Fortran IntelliSense, Code Runner, Fortran Breakpoint Support
Yes you can. Assuming that you want to execute in debug mode, you should create a tasks.json and a launcher.json and place them in .vscode/ at the root of your workspace.
Assuming the following file structure and a debugging mode with GDB for the execution:
root/
.vscode/
code/
Example_exe
This is what your tasks.json should look like:
{
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"type": "shell",
"command": "gfortran -o Example_exe Example.f90 -g",
"options": {
"cwd": "code/"
}
}
]
}
And then, the launch.json, which will identify tasks.json as a "preLaunchTask".
{
"version": "0.2.0",
"configurations":[
{
"name": "Run my example",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}\\code\\example_exe.exe",
"args": ["],
"stopAtEntry": false,
"cwd": "${workspaceFolder}\\code",
"miDebuggerPath": "gdb.exe",
"preLaunchTask": "compile",
}
]
}
Launch the debugger by pressing F5 (or in the Run menu).
If you don't want to run in debug mode, have a look at this issue.
Sources:
How to build and run C++ code in Visual Studio Code?
awesome tutorial (for ubuntu, working for me with VSCode-gfortran-Win10)
https://www.youtube.com/watch?v=Rj-kYb9nZ3g&ab_channel=LukasLamm.

Starlark debugger for Bazel in Visual Studio Code

i am new to Visual studio Code. I followed this tutorial to set up a Bazel build configuration in Visual studio code (I use Windows 10).
I created a simple task.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Example (Debug)",
"type": "shell",
"command": "bazel build //main:hello-world -c dbg",
"windows": {
"command": "bazel build //main:hello-world --experimental_enable_runfiles -c dbg"
},
"osx": {
"command": "bazel build //main:hello-world -c dbg --spawn_strategy=standalone",
},
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
and launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "cppvsdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"preLaunchTask": "Build Example (Debug)",
"cwd": "${workspaceFolder}/bazel-out/x64_windows-dbg/bin/example.exe.runfiles/__main__/",
"program": "${workspaceFolder}/bazel-out/x64_windows-dbg/bin/main/hello-world.exe",
"externalConsole": false,
"windows": {
"type": "cppdbg",
"type": "cppvsdbg",
"cwd": "${workspaceFolder}/bazel-out/x64_windows-dbg/bin",
"program": "${workspaceFolder}/bazel-out/x64_windows-dbg/bin/main/hello-world.exe",
},
},
}
]
}
In this way with run-> start debugging, I am able to debug and stop to breakpoins within the .cpp code of my project.
However, I read here, that is also possible to use the Starlark debugger to debug the .bzl files and Starlark rules.
According to the instructions in the same page I should be able to do this "by right-clicking a build target in the Bazel Build Targets view and selecting "Build Target with Starlark Debugger"". Unfortunately i can't see this option in my Bazel Build Targets view windows:
The Bazel Build Targets view is empty. and if i right click i can't see the "Build Target with Starlark Debugger" option. According to this link i should be able to see my targets listed below Bazel Build Targets view. I guess i am missing something in the configuration of the project or maybe some starlack extension?
Thanks for any help.
Bazel build targets does not work for me on windows either. When I run it, the extension outputs some error about bazel query. I haven't been on windows recently enough to remember the exact message, but I believe it is something along the lines of what is documented in this open issue.
Looks like there is a pull request open to solve it but no one has reviewed it yet. Best bet might be to weigh in over on either one of those after checking your extension output error log to see if it matches what is documented in there. Alternatively, you can check out the Clion with Bazel plugin, I have not tried that on windows yet though.

Marklogic XQY Debugger of Visual Studio Code

How do you setup the MarkLogic XQY Debugger in Visual Studio Code. Can someone direct me to actual sample example of debugging similar to the MarkLogic Java Script (JS) Debugger https://developer.marklogic.com/learn/visual-studio-code/
The steps to add and configure the XQuery debugger are similar to how to configure for JavaScript debugging. When creating a new launch.json, select MarkLogic XQY Debugger, instead of MarkLogic JS Debugger.
Example entries are documented in the Debugging section of the MarkLogic developer tools marketplace documentation, and on the GitHub project readme:
Debugging
Both JavaScript and XQuery debuggers support two modes of debugging:
Launch: Evaluates a main module (for JavaScript) or non-library module (for XQuery)
Attach: Intecepts an existing request, such as from an integration test
Where it can, query debugging uses the same VS Code settings used for running queries (for example, marklogic.host, marklogic.username). In addition to these code settings, you will need a launch config in your project (under .vscode/launch.json) for debug-specific parameters.
Open the launch.json from the VS Code command palette with the command: Debug: Open launch.json.
Below is an example of a launch.json file, with JavaScript and XQuery configurations for both launch and attach:
{
"version": "2.0.0",
"configurations": [
{
"request": "launch",
"type": "ml-jsdebugger",
"name": "Evaluate Current JavaScript Module"
},
{
"request": "attach",
"type": "ml-jsdebugger",
"name": "Attach to Debug Request",
"root": "${workspaceFolder}/src/main/ml-modules/root",
"debugServerName": "Enter debug server name"
},
{
"request": "launch",
"type": "xquery-ml",
"name": "Launch XQY Debug Request",
"program": "",
"root": "${workspaceFolder}/src/main/ml-modules/root"
},
{
"request": "attach",
"type": "xquery-ml",
"name": "Attach to XQY Debug request",
"root": "${workspaceFolder}/plugins"
}
]
}

issues debugging polymer straight from IDE/edit tool

I am quite new to Polymer and I would like to be able to debug projects straight from one IDE. I mean, instead of using Chrome debugger, I would prefer debug from Visual Studio Code or Sublime or Atom or another tool (kindly, there is no interest in this question to compare the IDEs available. I just want some way to debug from any IDE).
All subjects I have read so far didn't me drive to any real tutorial which could help me. The only one I found I couldn't make it run.
I followed https://medium.com/collaborne-engineering/debug-polymer-tests-with-vs-code-7646d66d0608 and when I try Run WCT I get Attribute 'program' doesn't exist.
My launch.json is
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Run wct",
"program": "${workspaceFolder}\\my-company-component.html",
"args": [
"-p",
"--skip-plugin", "local",
"--plugin", "none",
"--webserver-port", "2000",
"--expanded",
"--simpleOutput", "${workspaceFolder}"
]
},
{
"type": "chrome",
"request": "launch",
"name": "Run chrome for wct",
"url": "http://localhost:2000/components/my-company-component/generated-index.html",
"webRoot": "${workspaceRoot}",
"userDataDir": "${workspaceRoot}/.vscode/chrome"
}
]
}
Today, I have been using gulp to start a local server and then debug using Chrome but, in case it is possible use an IDE + some extension/plugin I would prefer.
program should be either 'wct' if you installed it with -g or
"${workspaceRoot}/node_modules/.bin/wct" if you installed it locally using npm.
That should solve your error, I did not get the other parts to work still though..
Well, after several tentatives and searching for while, I assume that the only way to debug is by using Chrome. I mean, I didn't find any efficient way to debug using Visual Studio Code, Atom or other IDE. I will consider https://github.com/Polymer/polymer/issues/3635 as an answer to my question.