I use VSCode with Unity3D and I wonder is there any way to hide/ignore/filter certain types of files, for example *.meta files in VSCode's tree view? I cant find any suitable option in settings.
How to hide files with specific extension in VSCode tree view
VS Code doesn't show desired Sass settings
How do I use Bash on Windows from the Visual Studio Code integrated terminal?
Visual Studio Code on Windows uses PowerShell by default as the integrated terminal. If you want to use Bash from Visual Studio Code, what steps should be followed?
Why does my Visual Studio Terminal print directories and links?
I a beginner and I cant seem to clean up my terminal. Every time I run code. Visual Studio prints it in its terminal and more than the code appears. How do I remove everything but the code? A simple Hello World code outputs this:
Windows PowerShellCopyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Owner\Desktop\Ex_Files_Learning_Python>& C:/Users/Owner/AppData/Local/Programs/Python/Python38-32/python.exe "c:/Users/Owner/Desktop/Ex_Files_Learning_Python/Exercise Files/Ch2/Untitled-1.py"hello world!PS C:\Users\Owner\Desktop\Ex_Files_Learning_Python>
VS Code: Case sensitive replacement after pressing Crtl - D
Let's suppose I have the following code:
But I change my mind and I don't want to call it plan
anymore. I want to call it schedule
. So, because VS Code is so amazing and I'm so lazy, I press <Ctrl - D>
hoping for VS Code to change the name respecting the case. But suddenly:
Is it there any way to tell VS Code to respect the case?
What causes this error with hello.py in vscode for Windows: "-bash: C:/Python37/python.exe: No such file or directory"?
When I click the play button to run my hello.py program in vscode, I get the following error in the terminal
PF1FEARB:~/tmp$ C:/Python37/python.exe c:/Users/xtn/hello.py-bash: C:/Python37/python.exe: No such file or directory
Manually running the script in the terminal works
PF1FEARB:~/tmp$ python hello.pyHello
My python.exe is installed here:
C:\Users\xtn\AppData\Local\bucache\cbdn10897X>where pythonC:\Python37\python.exe
Vscode shows the following installed extension
Name: PythonId: ms-python.pythonDescription: Linting, Debugging (multi-threaded, remote), Intellisense, Jupyter Notebooks, code formatting, refactoring, unit tests, snippets, and more.Version: 2020.2.64397Publisher: MicrosoftVS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python
How do I find out which PATH vscode uses to look for executables?
How to avoid conda activate base from automatically executing in my VS Code editor?
PS E:\Python and Data Science\PythonDatabase> conda activate baseconda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:1+ conda activate base+ ~~~~~+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException
PS E:\Python and Data Science\PythonDatabase>& C:/Users/Lenovo/Anaconda3/python.exe "e:/Python and Data Science/PythonDatabase/CourseHelper.py"Hello WorldPS E:\Python and Data Science\PythonDatabase>
VS Code Powershell Switch User
I am working in visual studio code for Powershell 7. (Finally took the dive) However, I need to run code as another user, Normally to do this, enter a new pssession on my computer. This creates something like sudo su. However, I am getting an error message stating access is denied.
code:
New-PSSession -Credential (Get-Credential) | Enter-PSSession
Error message:
New-PSSession : [localhost] Connecting to remote server localhost failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
I oftentimes work under a special system admin account.
Visual Studio Code: Failed to apply ESLint fixes to the document
I am using Visual Studio Code 1.6.1, with latest version of ESLint extension installed and enabled. I have
"eslint.options": {"rules": { ... }}
in my vs-code user settings.I was able to autofix my js files with the auto command "eslint.executeAutofix", but from maybe my last update of vs-code I am receiving the following error:
Failed to apply ESLint fixes to the document. Please consider opening an issue with steps to reproduce.
Can somebody please help me or point me in direction where I can fix this issue?
VSCode extension dependencies installation when installing extension
I've create an extension for visual studio code.In my package.json, I've a big list of dependencies :
"dependencies": {"@types/fs-extra": "^8.0.0","@types/puppeteer-core": "^2.0.0","@types/yamljs": "^0.2.30","anchor-markdown-header": "^0.5.7","clone": "^2.1.2","dedent": "^0.7.0","front-matter": "^3.0.2","fs-extra": "^8.1.0","get-port": "^5.1.1","highlight.js": "^9.18.0","localized-resource-manager": "^1.2.0","markdown-it": "^10.0.0","markdown-it-anchor": "^5.2.5","markdown-it-checkbox": "^1.1.0","markdown-it-emoji": "^1.4.0","markdown-it-table-of-contents": "^0.4.4","multi-integer-range": "^4.0.8","mustache": "^4.0.0","puppeteer-core": "^2.1.1","rxjs": "^6.5.4","serve-handler": "^6.1.2","simple-git": "^1.131.0","string-template": "^1.0.0","svn-spawn": "^0.1.6","temp-filesystem": "^1.1.3","transliteration": "^2.1.8","twemoji": "^12.1.5","utf8": "^3.0.0","website-scraper": "^4.2.0","yamljs": "^0.3.0" },
My problem is that I need to embed all these dependencies (and their dependencies) in my package node_modules folder.
So my package consists now of more than 5000 files and more than 300 MB.
Is there a way to not include the node_modules folder in the package but tell to vscode to install them when installing my extension ?
Thanks :)
Experimental decorators warning in TypeScript compilation
I receive the warning...
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to remove this warning.
... even though my compilerOptions in tsconfig.json have the following settings:
"emitDecoratorMetadata": true,"experimentalDecorators": true,
What is weird is that some random classes that use decorators do not show that warning but the rest in the same project do.
What could cause such behavior in the TypeScript compiler?
How to author a VSCode theme which syntaks tokens has a custom background color?
How can I debug installed VSCode extensions?
In Atom, I'm able to debug installed extensions by opening the developer tools (Option+Cmd+I) and browsing through JavaScript files in ~/.atom/packages
, e.g.
Is it possible to do this in VSCode? After opening the developer tools via Help -> Toggle Developer Tools, the only extension-related files I can find are the icon images:
Automate PyTest across Enviroments in VSCode
While VSCode recognizes the Test files and runs them, I find myself having to constantly switch environments to test various Python versions. What is the best way to set up a git commit/savefile hook to run my tests in different environments?
I tried using the provided tasks to set the environment and then execute the tests using dependsOn and dependsOrder, however, this appears to revert back to the set environment at the end of each individual tasks. Chaining them using && is also prohibited. Any other ideas?
Typescript: Custom type that parallels base type ignored
Expectation:If I create a custom type that parallels an existing type I expect to see variables assigned that type maintain that type and not fallback to to the paralleled base type. The function f
below should return a Dog
type instead a string
type.
type Dog = string;const f = (dog: Dog): Dog => { return dog;};
Is there a reason why Typescript does this? Is this a bug? I realize both approaches are by definition equivalent but I would like to use my custom types for readability. Any thoughts?
alphabetically sort TypeScript interface keys
Is there a way to automatically sort TypeScript interface keys? I'm already using Prettier and VSCode so ideally the solution would be with those but I'm open to any solutions.
For example,
// beforeinterface MyInterface { foo: number; bar: number; baz: number;}// after sortinterface MyInterface { bar: number; baz: number; foo: number;}
Conda virtual environment for IPython
I'm fairly new to the Python scene. My problem is that when I launch a jupyter notebook from an Anaconda Powershell with my DataScience
virtual environment activated, the notebook does not have my virtual environment in it's PATH, and therefore cannot find some packages (like plotly and progress). The same is true when I launch VS Code from Anaconda Navigator with DataScience activated. When I run import plotly
in an interactive window, I get ModuleNotFoundError: No module named ‘plotly’
. But when I run this line in the terminal within VS Code, it runs without error.
So I have run the following commands in various shell/terminal sessions:
import sys print(sys.path)
In a VS Code terminal I get:
['', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\python37.zip', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\DLLs', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\lib', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\lib\\site-packages']
In an interactive window in VS Code I get:
['C:\\Users\\adiad\\AppData\\Local\\Temp\\04e2b30c-4fc3-4aa9-9567-3aba17081a73', 'C:\\Users\\adiad\\Anaconda3\\python37.zip', 'C:\\Users\\adiad\\Anaconda3\\DLLs', 'C:\\Users\\adiad\\Anaconda3\\lib', 'C:\\Users\\adiad\\Anaconda3', '', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\adiad\\.ipython']
In a jupyter notebook running in my browser I get:
['C:\\Users\\adiad\\Anaconda3\\envs\\test', 'C:\\Users\\adiad\\Anaconda3\\python37.zip', 'C:\\Users\\adiad\\Anaconda3\\DLLs', 'C:\\Users\\adiad\\Anaconda3\\lib', 'C:\\Users\\adiad\\Anaconda3', '', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\adiad\\.ipython']
The IPython session don't appear to reference my virtual environment. So my question is: what do I need to do make IPython run with same environment as my terminal?
I found the following SO question which seems to answer my question, but I find it hard to believe that everyone is following this practice.How to start an ipython shell(not notebook) within a conda or virtualenv
Here's my configuration:
conda version : 4.7.12 conda-build version : 3.18.8 python version : 3.7.3.final.0 virtual packages : base environment : C:\Users\adiad\Anaconda3 (writable) channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\adiad\Anaconda3\pkgs C:\Users\adiad\.conda\pkgs C:\Users\adiad\AppData\Local\conda\conda\pkgs envs directories : C:\Users\adiad\Anaconda3\envs C:\Users\adiad\.conda\envs C:\Users\adiad\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.7.12 requests/2.22.0 CPython/3.7.3 Windows/10 Windows/10.0.18362
VS Code SSH issue
I'm having huge troubles with setting up Remote SSH in Visual Code. I have the keys generated, my config looks like this:
Host ubuntu_remote HostName 10.0.0.2 User test IdentityFile ~/.ssh/ubuntu_rsa
I can SSH to this machine via powershell using ubuntu_rsa without any issues. It's a VS Code issue for sure. My Remote SSH extension version is 0.51.0. I reinstalled VS Code but it did not help. The connection hangs at initializing VS Code Server, I left it for 15 minutes and nothing happened. If I cancel, the logs show:
[18:36:32.886] Install and start server if needed[18:36:34.656] getPlatformForHost was canceled[18:36:34.656] Resolver error: Connecting was canceled
Remote Develop and Debug JavaScript by Executing with sudo in VS Code with launch.json Configured for type: npm
// launch.json{"version": "0.2.0","configurations": [ {"type": "node","request": "launch","name": "Launch Program","skipFiles": ["<node_internals>/**" ],"program": "${workspaceFolder}/index.ts","preLaunchTask": "debug","outFiles": ["${workspaceFolder}/out/**/*.js"] } ]}
// tasks.json{"version": "2.0.0","tasks": [ {"label": "debug","group": "build","type": "npm","script": "buildfordebug","problemMatcher": ["$tsc"] } ]}
// package.json{"scripts": {"buildfordebug": "tsc --project ./tsconfig.json --outDir ./out" }}
Background
I have a typescript project which is located on a Linux PC and I develop it remotely on a Windows PC by using official extension "Remote Development" developed by Microsoft. Meanwhile, my program required itself to be executed with sudo in order to work.
I can run it normally by calling something like sudo ts-node ./index.ts
. However, when I try to use the debugger provided by VS Code, I cannot figure out a way how to debug my program with sudo.
Flow
- Press F5 to debug
- launch.json instruct debugger to reference and execute
debug
task debug
task reference debugger to executebuildfordebug
in npm script`buildfordebug
finished and debugger debugs outputed js according to the path specificed in launch.json outFiles
Can someone give me advice on how can I use the VS Code debugger to launch program with sudo? Thanks in advance.