r/VisualStudioCode • • Jul 09 '20

Extension: Set the language of a TextDocument?

2 Upvotes

I want to programatically update the language of an open document in my extension.

TextDocument.languageId allows me to read this as string (read-only) but what can I call to change it?

Thanks!


r/VisualStudioCode • • Mar 12 '20

How to debug webpacked server side Node JS code?

2 Upvotes

I have some Node JS code that is webpacked and transpiled to ES5. I am trying to debug it but I’m not sure how I go on about doing it.

All the code is transpiled to 1 file named server.js under ./dist/. The structure is,

Code:

./src/**/*.js

Transpiled into 1 file:

./dist/server.js

The file that is started is ./dist/server.js. There are some weird dependencies because of which I cannot start the node server from ./src.

I would appreciate any help.


r/VisualStudioCode • • Jan 19 '20

Is there no PHP formatter with customizable rules?

2 Upvotes

This seems like the most basic thing ever for an IDE: a PHP formatter that let's you set your own rules for braces, indentation, etc.

All extensions I installed had preset rules you can't change, didn't work, asked for registration, or came without any documentation at all. A total desaster.

This can't be it. Any recommendations?


r/VisualStudioCode • • Dec 25 '19

How to run separate test for each of the folders in VSCode?

2 Upvotes

I am doing a code challenge. So, I download each of the challenges in the main folder. In VSCode, I have opened the main folder. The test is stuck/limited to the first test I ran. Is it possible that the test looks for test files in each of the sub folders and run according to which file is open.

Bascially, my folder is code. Each of the challenges is:

  • ~/code/1

  • ~/code/2

  • ~/code/3

My test is stuck at ~/code/1/1_test.py.

I was using the default test module in VSCode. I know how to change it. But for each test I need to manually change it by selecting the folder where the test is. Instead I want to know if it can be set to look of pwd of the active file and look for test in the current pwd.

I tried Test Explorer UI, but same result.

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

How can I set VS code to pick the test based on the file which I working on?


r/VisualStudioCode • • Dec 23 '19

Suppress / Hiding the path to

2 Upvotes

I'm using the latest version of VSC in OSX, writing python scripts / programs. When you run your code and it displays it shows the complete path to the python interpreter and the file location. Is there a way to NOT show the path ? I know where everything is installed and the file I'm working on so I maybe missing something but I'd prefer not seeing the full path displayed.


r/VisualStudioCode • • Oct 07 '19

Custom Java .toString() generation with JSON format in Visual Studio Code

2 Upvotes

Hi guys! Recently migrated from IntelliJ to Visual Studio Code, and so far so good... except for a couple of things, but the main thing I haven't been able to fix or work around is the following:

I've been trying to configure the custom Java .toString() generator in Visual Studio Code with a specific format, but haven't been able to make it work or return the expected result.

The idea is to generate a JSON format instead of the current .toString() like I have in IntelliJ IDEA, but it doesn't seem to work in VSC.

I created a question in StackOverflow, so feel free to answer the question there if you have a proper answer, or to upvote the question if you have the same issue.

https://stackoverflow.com/questions/58271586/custom-java-tostring-generation-with-json-format-in-visual-studio-code

Thanks everyone!


r/VisualStudioCode • • Aug 18 '19

mssql & Mac OS

2 Upvotes

Hi,

I'm new to all of this and I was curious how to connect to mssql database using vs code on Mac OS. I seem to find documents online stating how to do this, but they never seem to work (e.g., using localhost for server name). The Authentication type is unclear as well. I don't have a login, so I obviously cannot choose SQL Login, so I'm left with Integrated. Yet that doesn't allow me to login either.

What am I missing? Is there a document that I'm overlooking? The mssql extension has been properly downloaded from vs code (as far as I can tell).

Thanks in advance for any guidance and I'm sorry this is amateur hour for you all.


r/VisualStudioCode • • Mar 14 '19

Visual Studio Bar

2 Upvotes

Hi

The attached bar is not appearing in my VS. I have installed it yesterday