Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full path to the folder where the currently active file in Visual Studio Code

I want to create a task in Visual Studio Code, but I need a path to the actual file. Is there some option?

My task:

{
    "version": "0.1.0",
    "command": "${workspaceRoot}/run.sh",
    "isShellCommand": true,
    "options": {
        "cwd": "${hereINeedPathToActualFile}"
    },
    "args": ["${file}"],
    "showOutput": "always"
}
like image 929
Well Avatar asked Apr 20 '16 05:04

Well


People also ask

What is the current file path for Visual Studio Code?

Current File Path for Visual Studio Code Visual Studio Code extension. This extension displays a current file path from absolute (root directory) or workspace highest directory in StatusBar by Unix style or Windows style.

How do I add a folder to a workspace in Visual Studio?

You can use drag and drop to add folders to a workspace. Drag a folder to the File Explorer to add it to the current workspace. You can even select and drag multiple folders. Note: Dropping a single folder into the editor region of VS Code will still open the folder in single folder mode.

What is current file path in StatusBar?

Current File Path. Visual Studio Code extension. This extension display current file's path from absolute (root directory) or workspace highest directory in StatusBar by Unix style or Windows style. Display a current file's path in the StatusBar.

How to show full path instead of workspace relative path?

There is a new setting window.showFullPaththat once enabled will show the full path to the currently opened file instead of the workspace relative path. The feature is planned to ship in the November release, currently in testing.


1 Answers

Go to Settings. Inside UserSettings, add this line to the JSON blob:

"window.title": "${activeEditorLong}"

like image 190
Peiti Li Avatar answered Sep 22 '22 02:09

Peiti Li