Code Monkey home page Code Monkey logo

open-in-editor's People

Contributors

chicoxyzzy avatar flpvsk avatar generalov avatar lahmatiy avatar pofigizm avatar silentroach avatar zefirka 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar

open-in-editor's Issues

vscode windows subsystem path issues

Hello, I ran into an issue where the path wouldn't translate properly when using the extension in WSL.

"alt-editor.name": "sublime",
"alt-editor.binary": "/mnt/c/program files/sublime text 3/sublime_text.exe",

had to change the fileLoc as quick fix for my use, as I also couldn't add through the arg settings:

const fileLoc = "\\\\wsl$\\ubuntu\\" + ${fileName}:${line}:${column}.replace(/\//g,"\\");

function openFile(fileName, line = 1, column = 1, config = {}) {
        if (!config || Object.keys(config).length === 0) {
        config = vscode.workspace.getConfiguration(extension);
    }
    const options = getEditorOptions(config);
    const fileLoc = "\\\\wsl$\\ubuntu\\" + `${fileName}:${line}:${column}`.replace(/\//g,"\\");
    const intro = vscode.window.setStatusBarMessage(`Opening ${fileLoc}...`);
    const res = createEditor(options)
        .then((editor) => editor.open(fileLoc))
        .then((openResult) => {
        intro.dispose();
        vscode.window.setStatusBarMessage(`Opened ${fileLoc}`, 5000);
        return openResult;
    })
        .catch((err) => {
        vscode.window.showErrorMessage(`Can't open the file ${fileLoc}: ${err}`)
            .then(() => intro.dispose());
    });
    return res;
}

Please add a case for WSL execution when you have time, it's a really handy extension. Thank you for your making it.

Add workspace placeholder

Apart from filename, line, column, could you please add workspace placeholder? This enables me to set pwd for vim on startup.

Default editor if ENV isn't set

Hello, is there any way of having the module check the ENV but default to eg Vim if nothing is present? As is, it throws an error of editor not set.

Thanks!

Vim support improvement

Recently #6 was merged. It adds basic support for open file in vim. However we need fix some issues:

  • it always creates new session of vim on every open file request
  • we need alternate what terminal to use – now it's Terminal, but we need iTerm support too
  • bring vim window on top when request to open a file

//cc @pofigizm

Is there a way to detect installed editors?

We use vscode and webstorm where I work and I'd like to show a list of options of all supported installed editors so the user can choose.

I know there is some detection going on internally but I'd like to know if this api is exposed. If not, could it be?

cheers

Not detecting JetBrains Toolbox desktop app

The JetBrains Toolbox desktop app doesn't install to C:\Program Files (x86)\JetBrains. Instead (at least on Windows), it installs to %LOCALAPPDATA%\JetBrains\Toolbox\apps. JetBrains editors are not detected if installed with the app.

Open based on File type

I have some binary files which only open with another tool. Everytime I "open" them, I'd like the external tool to start. I don't see that you can define which tool to call based on the file extension (or better yet a glob expression).

fix(makeArguments): No correct work if editor is emacs.

@lahmatiy I encountered a bug that open-in-editor does't work correctly when editor is emacs.

Background
reference:
aws-amplify/amplify-cli#1246

Bug summary
When aws-amplify/amplify-cli apply an option of add api, an error occurred as below.

Error: Command failed: osascript -e 'tell application "Terminal" to do script "cd /Users/chris/Projects/training/nab2019-aws-workshop/aws-amplify-unicorntrivia-workshop-master; emacs --no-splash \"+1:1\" \"/Users/chris/Projects/training/nab2019-aws-workshop/amplify/backend/api/adminpanel/schema.graphql"'\"
266:268: syntax error: A “"” can’t go after this “"”. (-2740)

I researched this bug and I found out that open-in-editor's escaping logic is wrong.

My proposal

To fix this bug, change lib/open.js as below.

diff --git a/lib/open.js b/lib/open.js
index 4d08053..50df999 100644
--- a/lib/open.js
+++ b/lib/open.js
@@ -33,7 +33,7 @@ function makeArguments(filename, settings) {
     //   {filename}:1:2
     //   => "filename:1:2"
     //
-    .replace(/\{filename\}(\S*)/, function(m, rest) {
+    .replace(/\{filename\}([^\\'"\s]*)/, function(m, rest) {
       return quote(info.filename + rest, settings.escapeQuotes);
     });
 }

Pull request
#16

Please consider that, I hope my pull request will be help to open-in-editor.

Thank you and best regard.

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.