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

VS code: JDK 13 not working in WSL ubuntu

$
0
0

For some reason whenever I try running VS code within the WSL it says that "The JAVA_HOME environment variable (/mnt/c/Program Files/jdk-13.0.1) does not point to a JDK."

When I simply run VS code normally(not in WSL) it works fine and there are no issues.

If anyone could help it would be greatly appreciated,

Thanks


VS Code extension to hide console.log commands?

$
0
0

My typescript files are usually littered with console.log commands to output values at various stages of execution. Is there a VS Code extension that automatically collapses .log commands when they are not clicked on?

What is VSCode's regular expression capture group notation for numbered backreferences?

$
0
0

Does VSCode have support for numbered backreferences? I'm trying to do a find replace from the dialog but it matches the entire regex and replaces with a literal \1

find replace dialog attempt at numbered backreference syntax

# Regex
<tr><th align="right">target</th><td><pre>(.*)</pre></td></tr>

What is the regex engine that VSCode actually uses under the hood?

Why "ls" command is not working on Windows CMD while working on VS Code Terminal?

$
0
0

"ls" command is not working on my windows cmd while it is working on visual studio code. Can you please tell me why ?

E:\ls

VSCode SourceMap cannot catch breakpoint Vuejs

$
0
0

I'm using vscode to write my code in VueJs and in order to debug I'm using a config I found which doesn't work correctly:

module.exports = {
        runtimeCompiler: true,
        productionSourceMap: false,
        configureWebpack: {
        devtool: 'source-map'
    },

    publicPath: process.env.NODE_ENV === 'production' ? './' : '/' 
}

But unfortunately every time I put a breakpoint, VsCode relocate this point few lines behind being impossible to debug the exact place I want.

For example if I try to create a breakpoint on the line 363 the red dot is displayed on the line 352 and the breakpoint is never triggered. At the moment I have been using "debugger" sentence to debug correctly.

enter image description here

Many thanks!

Detect git subfolder in Visual studio code

$
0
0

I have a folder where the root folder is not git repository but the underlying src/ folder is. So for example I have this

 ~/workspace/some_project_folder <-- not a git repository
 ~/workspace/some_project_folder/src <-- git repository
 ~/workspace/some_project_folder/some_other_folder <-- not a git repository
 ~/workspace/some_project_folder/transient_data <-- not a git repository

(Note this structure is by all means not good but this what I have inherited. I will change this in the future, I just want a workaround for the moment)

I was searching for option to specify that my main git folder is under src but could not find any such option.

Is there a way to to recognise subfolders in Visual Studio Code? Currently sticking with the cmd git.

How we can make in VS, like this in picture i.e gap of line 95 and 96 as well 97 and 98

Visual Studio Code C++, I would like to run the output in a cmd

$
0
0

I would like to run the output of the c++ code that I have made in a command prompt rather than the terminal. Also, if I run an infinite loop, how would I terminate the current program given that I am in terminal? Still, can somebody help me run my codes in a cmd[command prompt] instead of terminal? I have been using code runner.


VS Code snippet with multiple transforms

$
0
0

I am trying to make a snippet that will take clipboard contents (the text of a heading in a markdown document) and transform it into a link to that section. For example, if my clipboard contains: Some Heading - 20191107 then I want the following to be output:

[Some Heading - 20191107](filename.md#some-heading---20191107)

Here is my snippet VS Code for markdown so far:

"link to this section": {
        "prefix": "isection",
        "body": [
            "[${1:${CLIPBOARD}}](${TM_FILENAME}#${CLIPBOARD/ /-/g})"
        ],
        "description": "Insert link to section whose heading text is in the clipboard"
    }

This has the first transform, but what I cannot figure out is how to nest multiple transforms:

  • Replace all space with a hyphen.
  • Change all to lower case.
  • Remove any characters matching [^a-z0-9-]

How to set VSCODE bookmark with single mouse click

$
0
0

Visual Studio Code 1.32, Bookmarks extension 10. After installing this extension, I can open the Bookmarks explorer, toggle bookmarks using context menu and shortcut:

bookmark menu

Left-most code editor column is reserved for breakpoint. By clicking it, I can only set/remove a breakpoint. How can I toggle bookmark by clicking the code line, or by clicking some toolbar button, like in Visual Studio?

Unrecognized option: -ea,--enable-preview error shown in a Java standalone project, VSCode

$
0
0

I have yet to find any documentation regarding this problem. In a standalone project, the following error shows up when I attempt to run a simple JUnit test. Even after configuring the launch.json file and adding the following argument to vmArgs, the same error shows up. The file use to run fine 2 weeks ago and I haven't touched it since. Is this because of a new VSCode update? Or?

The files work fine using Maven and the "Create Java Project" command.

Error:

Unrecognized option: -ea,--enable-preview
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

VS Code task process stdout/stderr

$
0
0

I'm attempting to write some test for a VS Code extension.

The extension basically creates some tasks, using ShellExecution to run a local executable file, for example:

new Task(
  definition,
  folder,
  name,
  source,
  new ShellExecution('./runme', { cwd })
);

I would like to be able to test the shell process, but don't have access to this process and so cannot attach to any of the output streams nor get the exit code.

In my tests, I execute the task like so: await vscode.tasks.executeTask(task); which runs successfully regardless of the exit code of the process created by ShellExecution.

Is there any way I can get access to the child process generated from executing a task?

vscode always ask for permission to save

$
0
0

I'm new to Ubuntu and here is my issue:
VSCode is always asking for permission to save any edit on any file.

I just want to edit and save without having to enter my password every time so is this possible on Ubuntu?
I tried to add a new user, but I see also the same problem.
I tried to run VSCode as root, but it said it's dangerous to run it as root.

How can I avoid this permission step when saving a file with VSCode?

How to install npm package while offline?

$
0
0

I'm working on an offline network and want to install angular-cli using npm. I have a zip file of angular-cli and using the latest node and npm version. I'm using the command: npm install ./angular-cli-master to install angular-cli from the folder. But I keep getting this error telling me I don't have an internet connection (which is ok). So how can I install this angular-cli while offline using the zip I downloaded from Github?

Thanks for your help.

How do I keep text selected when changing from Visual to Insert mode?

$
0
0

I am running Vim extension in VS Code and want to be able to select text using Visual mode and keep that text selected when I'm in Insert mode. Currently I am able to select text in Visual mode but the selection becomes unselected when I change to Insert mode. Is this possible?


Issue in visual studio code?

$
0
0

I want to use selenium+java on VSC, can anyone suggest me how to run a script there,nugget manager etc. extension it shows the path referred message,but still not able to code.

Redirect input/output to/from the debug target Visual Studio Code C

$
0
0

First of all, I am using VS Code and I am coding in C.

I want to take input from a file and write output to a file. In cmd, I used this code:

test.exe < input.txt > output.txt

It perfectly works. When I try to debug, I can not provide input. I checked https://code.visualstudio.com/Docs/editor/debugging, and I edited my launch.json:

"args": [
            "<", 
            "input.txt",
            ">",
            "output.txt"
        ],

This configuration is not working. Debug was started but the program wait the input. Is it possible to redirect input and output when I debugging? Thank you.

Visual Studio Code Quick Constructor for Dart not working

$
0
0

I created this Dart Class in Visual Studio Code:

class User {
  String userId;
  String info;
}

Ctrl + . not opening the quick fix menu for a quick constructor.

enter image description here

Any suggestions on how to show all of the quick-fix options? like this -

enter image description here

Error in VS Code dotnet core C#: "The type or namespace name 'System' could not be found", but build succeeds

$
0
0

When trying to work with Visual Studio Code on a C# DotNet Core MVC application, I am having a lot of trouble getting visual studio code to work. It is having trouble finding anything related to C#, marking even 'Using System;' as invalid, saying it can't find it.

However, when I run dotnet build, it succeeds with no warnings or errors and the project runs.

My project.json:

 {
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.EntityFrameworkCore.Sqlite": "1.1.0",
    "Microsoft.EntityFrameworkCore.Design": {
      "version": "1.1.0",
      "type": "build"
    },
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.1.0"
        }
      },
      "imports": "dnxcore50"
    }
  }
}

Any ideas? I'm really pulling my hair out with this one.

how to stop a command in the VS Code terminal

$
0
0

I've been stopping commands with the trash can for too long. Command period doesn't work on Mac. I can't find anywhere how to stop the terminal via a command. Anyone know what it is?

Viewing all 99267 articles
Browse latest View live


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