Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy-formatted-for-elm-repl: copy selected code into clipboard formatted for pasting into repl #167

Open
stepheneb opened this issue May 9, 2019 · 4 comments

Comments

@stepheneb
Copy link

I'd like to be able to copy selected multiline Elm code into the clipboard and be able to paste it into the elm repl formatted to be able to be successfully evaluated.

I'm curious whether this is possible ... and how hard it would be -- or maybe it already exists??

For example this code copied and pasted into the elm repl generates an error:

type alias Option =
    { id : Int
    , name : Stri

Adding \ at the end of each line except for the last allows the repl to evaluate it successfully:

type alias Option = \
    { id : Int \
    , name : String \
    }
@SidneyNemzer
Copy link

It seems like copying with newlines escaped could be useful for a text editor in general. Maybe it could be made into its own package? (I didn't see an existing package like this during a quick search).

@halohalospecial
Copy link
Owner

@stepheneb, the feature shouldn't be hard to implement, but it would be a special copy command (e.g. Elmjutsu: Copy For Repl). Are you okay with that?

@stepheneb
Copy link
Author

stepheneb commented May 22, 2019 via email

@halohalospecial
Copy link
Owner

@stepheneb, you can add the command in lib/main.js

Somewhere here:

this.subscriptions.add(
      atom.commands.add(
        'atom-text-editor:not([mini])[data-grammar^="source elm"]',
        {
          'elmjutsu:quick-fix-file': () => this.quickFix.quickFixFileCommand(),
          'elmjutsu:set-main-paths': () =>
            this.elmMakeRunner.setMainPathsCommand(),
          'elmjutsu:set-compile-output-path': () =>
            this.elmMakeRunner.setCompileOutputPathCommand(),
          'elmjutsu:go-to-definition': () => this.goTo.goToDefinitionCommand(),
          'elmjutsu:go-to-symbol': () => this.goToSymbol.goToSymbolCommand(),
          'elmjutsu:find-usages': () =>
            this.findAndRenameUsages.findUsagesCommand(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants