Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all 98524 articles
Browse latest View live

Visual Studio Code, Java Extension, howto add jar to classpath

$
0
0

In Eclipse, I add a jar library using

project -> build path ->configure build path

What is the equivalent in VisualStudioCode? I had a look into launch.json. There is a classpath defined. Adding jars to this classpath (array) variable seems to have no effect.

Essentially, this is a duplicate question of Visual Studio Java Language Support add jar But that question is unanswered.

This is such an extremely basic question, that I really don't understand not to find a solution for it in Microsoft's documentation or via Google search.


Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9229)

$
0
0

I am trying to set up VSCode to debug an npm script.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch via NPM",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["run-script", "test"],
      "port": 9229
    }
  ]
}

But I am getting this error:

Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9229).

How to reference compilerPath in Visual Studio Code build task

$
0
0

I am going through the Configure VS Code for Microsoft C++ document. The Configure the compiler path section describes how to define configurations. The configuration defines the compilerPath. Then the Create a build task section says to just set the command to "cl.exe."

Is there a way to reference the compiler path instead of just using "cl.exe."

I have defined two configurations, msvc-x86 (which uses x86 version of the compiler) and msvc-x64 (which uses x64 version of the compiler). I want to be able to use "C/C++ Select a Configuration" to choose the active configuration and then have build use the correct compiler.

Based on the Variable substitution section of the Integrate with External Tools via Task page, it should be possible to do this with "${config:magical_incantation}" but the documentation does not provide information on what magical_incantation should be.

Managing Formatters in VScode

$
0
0

I'm getting a duplicate of C/C++ (default) Formatter. This causes one of them to not work and i'm unable to configure the default formatter to use the one that does work. How can i remove one of them ? The main problem is that i cant use format on save feature if the default is wrong.

vs code expand selection doesn't respect word separators setting

$
0
0

When I run the command "Expand Selection" with my cursor in a kebab-case-word-like-this, I want it to select the whole word including the dashes, but it breaks at the dash, even though my configured "Editor: Word Separators" does not include dash (it's unchanged from the default). Any way to make it select the entire thing on the first expansion? Kebab case is the convention for clojure and this glitch makes it really tedious.

How to undo "Don't show this prompt again" in vscode python?

$
0
0

Accidentally selected "Don't show this prompt again" when prompted to install Pylint in VSCode Python. How should I undo/reset the action so the prompt will appear again?

Why doesn't this problemMatcher in VS code work?

$
0
0

Why doesnt my problemMatcher work? I'm pretty sure about the regex, but it doesn't report any problems, even there are some on stdout...

// the matcher
"problemMatcher": {
    "owner": "typescript",
    "fileLocation": ["relative", "${workspaceRoot}"],
    "pattern": {
        "regexp": "^TypeScript (warning|error): (.*)\\((\\d+),(\\d+)\\): (.*)$",
        "severity": 1,
        "file": 2,
        "line": 3,
        "column": 4,
        "message": 5
    }
}

//the browserify/tsify pipeline
browserify().add('main.ts')
  .plugin(tsify, { noImplicitAny: false, removeComments:true })
  .transform("babelify",{ extensions: ['.ts'], presets: ["es2015"]})
  .bundle()
  .on('error', function (error) { console.log(error.toString()); })
  .pipe(source('bundle.js'))
  .pipe(gulp.dest('www/js/dist/'));

//gulp sample output
[00:39:00] Starting 'ts-compile'...
TypeScript error: main.ts(118,30): Error TS2339: Property 'object' does not exist on type 'boolean'.
TypeScript error: main.ts(137,24): Error TS2339: Property 'object' does not exist on type 'boolean'.
TypeScript error: main.ts(507,44): Error TS2304: Cannot find name 'loading'.
[00:39:03] Finished 'ts-compile' after 2.98 s

How to add the custom "when clause" in VS Code?

$
0
0

Currently, I am developing a simple add-in for the .NET Core 3.0 blazor web projects. In this case, I want to enable the add-in if the .net core 3.0 blazor projects and if the project is not the .net core 3.0 blazor project, my custom add-in will not be shown.

I have googled regarding vscode add-in extension and found the default when clause for vscode like "when": "explorerResourceIsFolder" etc. But I want the add-in in workspace header with the condition like if the project is .net core 3.0 blazor. I don't know about how and where to add the logic for this.

enter image description here

I need to add my own condition for When clause to show my add-in. Also, If the project has my custom assemblies, I need to show another add-in in the explorer heading context menu with my own customized when clause.

Could you please suggest me how can I achieve this?

Below is my coding part:

Package.Json

"commands": [
            {
                "command": "extension.openTemplatesFolder",
                "title": "Open Templates Folder",
                "category": "Project"
            },
            {
                "command": "extension.saveProjectAsTemplate",
                "title": "Save Project as Template",
                "category": "Project"
            },
            {
                "command": "extension.deleteTemplate",
                "title": "Delete Existing Template",
                "category": "Project"
            },
            {
                "command": "extension.createProjectFromTemplate",
                "title": "Create Project from Template",
                "category": "Project"
            }
        ],
        "menus": {
            "explorer/context": [
                {
                    "command": "extension.saveProjectAsTemplate",
                    "when": "myContext == success && explorerResourceIsRoot",
                    "group": "projectTemplates@1"
                }
            ]
        }

extension.ts

const value = "success";
vscode.commands.executeCommand('setContext', 'myContext', `${value}`);



export function activate(context: vscode.ExtensionContext) {



    // create manager and initialize template folder
    let projectTemplatesPlugin = new ProjectTemplatesPlugin(context, vscode.workspace.getConfiguration('projectTemplates'));
    projectTemplatesPlugin.createTemplatesDirIfNotExists();

    // register commands



    // open templates folder
    let openTemplatesFolder = vscode.commands.registerCommand('extension.openTemplatesFolder', 
        OpenTemplatesFolderCommand.run.bind(undefined, projectTemplatesPlugin));
    context.subscriptions.push(openTemplatesFolder);

    // save as template
    let saveProjectAsTemplate = vscode.commands.registerCommand('extension.saveProjectAsTemplate', 
        SaveProjectAsTemplateCommand.run.bind(undefined, projectTemplatesPlugin));
    context.subscriptions.push(saveProjectAsTemplate);
}

Note: The vscode.commands.executeCommand('setContext', 'myContext', value); is not executed before show the add-in. It was executed after click the add-in


VSCode problemMatcher severity mapping

$
0
0

I have a custom problemMatcher for an ant task that calls Microsoft JScript to lint JavaScript files (which I can not change to something modern like ESHint or similar).

JScript has error messages that itself reports as "This error can be ignored...", which looks like the following in the build output:

     [echo] c:\Users\D064766\Work\Perforce\tc1\lightspeed\dev\src\_javascript\jsgen\js\dbg\lightspeed.js(20, 4) Microsoft JScript runtime error: 'document' is undefined
     [echo] 
     [echo] This error can be ignored...

My problemMatcher looks is as follows:

"problemMatcher": [{
    "owner": "javascript",
    "fileLocation": ["absolute"],
    "pattern": [{
        "regexp": "     \\[echo\\] ([^\\(\\)]*)\\((\\d+), (\\d+)\\) Microsoft JScript (runtime error|compilation error): (.*)",
        "file": 1,
        "line": 2,
        "column": 3,
        "severity": 4,
        "message": 5
    }]
}]

It correctly finds the first line of the error report. I however want that errors that can be ignored occur as warnings rather than errors in the error reporting.

Is there a way to map error messages to severity levels?

E.g. map "runtime error" to "warning" and "compilation error" to "error" (short-sighted, I know -- would be enough for the moment).

VS Code: login to TFS not with a password, but a smartcard

$
0
0

I'm trying to connect VS Code to our corporate TFS/TFVC.

When executing "Team: Signin", it asks for a username and password. I don't have these. I usually (also in Visual Studio) enter my corporate email address, then a dialog pops up where I can authenticate myself via smartcard.

I also tried to do it via token, I don't see where I can enter it.

How can I successfully log in?

VS Code $msCompile problemMatcher doesn't work with relative file path

$
0
0

I need to compile a .NET solution using Visual Studio Code. My task inside tasks.json is declared like:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "args": [
                "build",
                "${workspaceFolder}"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

Now pressing Ctrl+B I can successfully compile my entire solution. Unfortunately dotnet build seems to output relative file path, and from the documentation the $msCompile problem matcher works only with absolute path. The effect is that when there is an error clicking on it inside the Problems panel produce the error Unable to open XYZ.cs: File not found.

How can I correctly configure dotnet build or problemMatcher to work?

VSC unable to watch for file changes in this large workspace weird

$
0
0

I just started using VSCode version 1.24.1.

After loading a folder, it shows warning

Visual Studio Code is unable to watch for file changes in this large workspace

After i check the limit as suggested on their guide, using

cat /proc/sys/fs/inotify/max_user_watches

I get 8192, while my project has only 650 files (of which 400 are inside .git)

Why does this happen? Is this a bug or am I missing something?

(Increasing the limit is clearly not the right solution.)

Replace line breaks

$
0
0

I am using visual studio code for several things. Everything is working fine, but I cannot get one specific thing to work.

I need the ability to remove line breaks from the text.

Example:

first line
second line

Should become:

first linesecondline

Since a recent update it is possible to search for line breaks with using ^$. It is described here: https://github.com/Microsoft/vscode/pull/314

The problem I have is that when I use this for replacing, it does actually "add" to the line break and does not "replace" it.

Warning: unrecognized cop Rails/

$
0
0

I have problems with Rubocop in Vs-code. I get the error

Warning: unrecognized cop Rails/ActionFilter found in /path/to/yml/with/cops
...
Warning: unrecognized cop Rails/Output found in
...
Warning: unrecognized cop Rails/UnknownEnv found in
...
# The list goes on...

I run:

Rubocop version rubocop-0.76.0

VS-code Version: 1.39.2

ruby-rubocop extention in vs code: 0.8.1

macOS Catalina: 10.15 (Problem existed in earlier versions like mojave)


I find very little about this problem. Basically only thing I found was this. And I already have require rubocop-rspec in my rspec yml file so no success with the proposals from that thread.

What can I do to solve this? My co-workers will soon start to call me Mr. Lint-failure

Why I cannot set breakpoint on visual code with nodejs

$
0
0

I am working with nodejs and visual code as IDE. However, It suddenly stops allow me to set breakpoints at some lines, that are marked as red and yellow. I have no idea what is the reason. It could be an extension, but it seems not because I disable all extension and still can't set the breakpoint. Also, when I set the mouse pointer at some variable of the referred lines, it shows X0 or X1 header on the message. here is a picture of what I see

enter image description here

It seems it is a bug. I am using Ubuntu 18.04 In console: npm version 6.11.3 node version v12.11.1

Has anybody any ideas?


How to set the Maven profiles in Visual Studio Code?

$
0
0

I couldn't find the way to set the current Maven profiles in Visual Studio Code in order to compile my project using specific profiles, does someone know how to do that?

New File/Folder functionality in TreeView

$
0
0

Is it possible to replicate the "New File/Folder" functionality found the in the explorer in a TreeView? I know how to add the button and insert a new TreeItem, but not how to make the label editable in the UI.

Here's a picture which hopefully makes it more clear what im trying to do.

Image

ibm-db : ImportError: DLL load failed: The specified module could not be found in VSCode on Windows 10

$
0
0

ibm-db 2.0.9 Python 3.7.5 Visual Studio Code 1.39.2

Error Details PS C:\Users\userID\Desktop\Architect\Python\Code>& C:/Users/userID/AppData/Local/Microsoft/WindowsApps/python.exe c:/Users/userID/Desktop/Architect/Python/Code/database/data_query_pandas.py Traceback (most recent call last): File "c:/Users/userID/Desktop/Architect/Python/Code/database/data_query_pandas.py", line 3, in import ibm_db File "C:\Users\userID\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\ibm_db.py", line 10, in bootstrap() File "C:\Users\userID\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\ibm_db.py", line 9, in bootstrap imp.load_dynamic(name,file) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found. PS C:\Users\userID\Desktop\Architect\Python\Code>

Paths Set IBM_DB_HOME - C:\Program Files (x86)\IBM\SQLLIB\BIN

ibm_db_path C:\Users\userID\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\ibm_db_dlls

Path C:\Users\userID\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\ibm_db_dlls C:\Users\userID\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86 C:\Program Files\Microsoft VS Code\bin C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0

ImportError: DLL load failed: The specified module could not be found.

Apex replay debugger is throwing Java 8 is required to run

$
0
0

I am following this trail and I have completed all the steps correctly. Even I able to download the debug logs. But Problem occurs when I am trying to run the following command

> SFDX: Launch Apex Replay Debugger with Current File

It shows the below error.

enter image description here

But, the thing is, I have jdk-12.0.1 installed on my PC. After that, I have installed the Java 8 also and thus jdk-1.8.0_181 is also installed.

enter image description here

My Java Home setting in VS code is following

enter image description here

I have also restarted my PC, But no luck. It is throwing the same error.

How to solve this ?

ModuleNotFoundError: No module named 'tensorflow'

$
0
0

I am trying to install tensorflow in vscode(Windows 10) but am getting this error ModuleNotFoundError: No module named 'tensorflow'. I have tried setting up a new conda environment, used python 3.5 and have also configured the 'Path' setting but to no avail. Even though TensorFlow has succesfully installed in my system, whenever I try to import, it doesn't work... Previously I had been using Ubuntu smoothly but getting it on win10 is being very frustrating. BTW when I install TensorFlow directly from the Anaconda-navigator, it tells me the error message "Too many errors".

Any help is appreciated...

THIS IS MY TEST CODE:-

import tensorflow as tf
print (tf.__version__)
print ('Hello world')

EDIT:- I ran this code through an anaconda terminal(after activating environment) and got this new 'verbose' message

Traceback (most recent call last):
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 938, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import tensorflow as tf
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 938, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Users\neelg\.conda\envs\TF-gpu\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
Viewing all 98524 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>