Code Monkey home page Code Monkey logo

vscode-edit-with-shell's People

Contributors

alexreg avatar dependabot[bot] avatar ryu1kn avatar stevenguh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vscode-edit-with-shell's Issues

(bug) Hangs after non input-consuming command (such as pwd, echo, date)

Some commands like pwd or date are useful when editing but don't consume any input. It looks like the plugin hangs the first time you run one of these.

For example:

  1. Run fmt and see it succeed.
    • The prompt disappears.
    • The text is updated.
  2. Run pwd and see it hang.
    • The prompt stays visible.
    • The text is unchanged.
  3. Run fmt again and see it hang.

Running Cmd-Shift-P > Developer: Reload Window fixes it.

I also notice that cat > tmp ; pwd succeeds, so the problem seems to be with whether the input is consumed, rather than pwd in particular.

Also, head succeeds, so the plugin doesn't mind when the command closes its input early.

Maybe the problem is that the plugin is waiting for the command to close its input? And instead it should wait for the process to exit.

Possibility to set LANG to avoid utf-8 issues

If I have this text:

And do a column -t -c200 -s\; in a terminal with LANG="en_US.UTF-8", it correctly outputs:

Whereas in EditWithShell, it misses the special utf-8 characters and outputs:

It would be nice to set some kind of locale variables (or simply LANG) to make it produce the correct output.

Command to clear history

The history feature is quite useful, but if it gets cluttered, it might be useful to have a command to clear it. Would you kindly be able to add this?

Eliminate leading "escape"?

Is it possible to eliminate having to press escape to type a new shell command?

At first invocation, it goes into a "search the command history" mode, but I'd rather it go straight into editing-the-command mode, where up/down arrows would switch between previous commands, and right-left arrows would let you modify the current command, and enter would run it immediately.

Even better would be to have "/" switch into "search the history" mode.

Request: option to ignore warnings

Is it possible to add an option to ignore warnings which may be issued on stderr?
The reason I'm asking is that I'm using this extension to run Tcl code through an ancient formatter called frink that almost always produces warnings. The warnings are correctly displayed and can be useful, however the text/file being processed is then left unchanged. It would be nice to have an option to override this and accept the changed text. Thanks.

How can I use Predefined Variable With Shell Command

When I run a command with predefined variable, it does not expand that variable.

Suppose I have selected a text example.png in the editor, then run xargs -I {} echo '${fileDirname}'{}, the output is ${fileDirname}example.png instead of path/to/file/example.png

What can I do?

Error message is unnecessarily escaped

I try to run a local script awesome_script.py param1 param2 the error I got was awesome\_script.py command not found. Note that added \ to the command name.
When I run the same script directly with my shell, e.g /bin/sh -c awesome_script.py param1 param2 everything works like a charm..

Use a selected text in a command string

Sometimes I want a selected text to be available as a literal or variable instead of a standard input.

The other day, I had a text like Current time is 1594121655693, and wanted to convert the timestamp to ISO string (i.e. Current time is 2020-07-07T11:34:15.693Z), by selecting the number part and run node -p 'new Date(1594121655693).toISOString().

The number comes as stdin, so I could do

node -p "new Date(parseInt(require('fs').readFileSync('/dev/stdin', 'utf8'))).toISOString()"

but I don't want to do that. Perhaps the extension can make the string in stdin available as an environment variable (e.g. ES_STDIN)? Then we can select 1594121655693 and run this command to convert to an ISO format.

node -p "new Date($ES_STDIN).toISOString()"

Multi-Cursor Mode

Hello. This is an exciting extension. 👍

I have spend about 7 hours to be able to change the case of selected text to title case format using Turkish locale in VS Code. But I couldn't do that.

Then using this great extension, it became very easy. Here is the command I use:
LC_ALL=tr_TR.UTF-8 sed 's/[^ ]+/\L\u&/g'

But it doesn't work in multi-cursor mode. Only the first selection transforming.

It would be excellent if you could support Multi-Cursor mode.

Thanks.

Request: Show favorite commands from "EditWithShell: Run command"

When invoking EditWithShell: Run command from a new VS Code window, the command history is empty as expected, but it would be nice to be able to also see the favorite commands configured in editWithShell.favoriteCommands in this list. This way users could configure frequently used commands and not have to type them again each time VS Code is restarted. The quick commands feature is nice (e.g., EditWithShell: Run quick command 1), but it is hard to tell what command is going to be run.

Also, if the favorite commands were listed by EditWithShell: Run command, the user could select one of the pre-configured commands and edit the command before executing it, which is not possible with EditWithShell: Run quick command 1.

FR: Run specific command

I have a need for running various shell commands on text. This extension offers that capability, but I would instead like to always run a specific shell command when executing a shortcut.

Would it be possible to add this capability to the extension?

In unsaved new tab with a project root, could $CWD be set to to project root instead of home directory?

I'd like $CWD to be set to the particular folder that the open file is in if available, but if it's not available I'd prefer to try to fall back to the project root first before falling all the way back to the home directory.

Relevant tests:

it('returns the directory of the current file if currentDirectoryKind is set to "currentFile"', () => {
const execContext = new ShellCommandExecContext(fakeWorkspaceAdapter('currentFile'), {env: {}});
assert.deepStrictEqual(execContext.getCwd('DIR/FILE'), 'DIR');
});
it('returns user\'s home directory if currentDirectoryKind is set to "currentFile" but not available', () => {
const execContext = new ShellCommandExecContext(fakeWorkspaceAdapter('currentFile'), {env: {HOME: 'USER_HOME_DIR'}});
assert.deepStrictEqual(execContext.getCwd(), 'USER_HOME_DIR');
});
it('returns project root directory if currentDirectoryKind is set to "workspaceRoot"', () => {
const execContext = new ShellCommandExecContext(fakeWorkspaceAdapter('workspaceRoot', 'PROJECT_ROOT_PATH'), {env: {}});
assert.deepStrictEqual(execContext.getCwd(), 'PROJECT_ROOT_PATH');
});
it('returns user\'s home directory if currentDirectoryKind is set to "workspaceRoot" but not available', () => {
const execContext = new ShellCommandExecContext(fakeWorkspaceAdapter('workspaceRoot'), {env: {HOME: 'USER_HOME_DIR'}});
assert.deepStrictEqual(execContext.getCwd(), 'USER_HOME_DIR');
});

Quick screengrab I recorded demonstrating current behavior:

Screen.Recording.2021-09-09.at.1.22.58.PM.mov

Current result of ^ looks like:

currentFile   -> /Users/tim.vergenz
workspaceRoot -> /Users/tim.vergenz/code/vscode-edit-with-shell

I'd prefer that it look like:

currentFile   -> /Users/tim.vergenz/code/vscode-edit-with-shell
workspaceRoot -> /Users/tim.vergenz/code/vscode-edit-with-shell

What shell does this run in?

I have a command called icalBuddy that if I run in the shell outputs my calendar events for tomorrow.

If I run it with edit-with-shell, it tells me "No calendars". So something about the context that this runs in must be off. Can you explain please?

Request: If no text currently selected, use whole file.

I use a command like this in TextMate all the time (100+ times per day), and most of the time I'm just trying to filter the current file with grep / cut / sort / etc. So usually I don't want to select just a portion of the file.

Could this default to doing the whole file if no text is selected, or have a config option to work that way? In trying to migrate over to vscode, this would be awesome.

request: output to temporary file

Would it be possible to add a command that creates a new temporary file with the output instead of replacing the selection/entire file? Something like Filter Text vs Filter Text Inplace of the FilterText extension.

WSL Bash doesn't work

Hi,

I went and changed the setting to use Bash from Windows Subsystem for Linux, then I tried a simple command and I'm getting an error.

Settings:

{
    "editWithShell.shell.windows": "bash.exe",
    "editWithShell.shellArgs.windows": []
}

Command: cut -d, -f3 (I also tried: cut -d, -f3 | sort. Didn't work either)

Error I'm seeing is: /bin/bash: cut -d, -f3: No such file or directory

My VSCode version is:

Version: 1.30.1 (user setup)
Commit: dea8705087adb1b5e5ae1d9123278e178656186a
Date: 2018-12-18T18:12:07.165Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Windows_NT x64 10.0.17763

The extension version is: 1.1.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.