Glavin001 / Glavin001/atom-preview

Copy from one language and Paste to another

Open
#54 8 comments 0 reactions 0 assignees View on GitHub
enhancement feature help wanted
Dominant language
CoffeeScript
Stars
51
Forks
23
PR merge metrics
No merged PRs in 30d

Description

We can currently preview many languages to a variety of others in a real-time tab view. However, what if you are working on one source code base in one language, and migrating to another language with the same goals in mind. My real-life example is building a SDK library for an API in one language (JavaScript) and moving to another language (Objective-C). Of course, there are no converters from JavaScript to Objective-C, we know there are some languages that can transform into others (See Groovy to JavaScript, #53 ). What about taking someone else's open-source CoffeeScript library and copying that source code into your own JavaScript library? What if it was as simple and seamless as copy & paste?

Implementation is fairly easy:
- [ ] Add a package command for `preview:copy` and `preview:paste`.
- [ ] On `preview:copy`, save the current editor's `text`, `grammar`, and `filepath`.
- On `preview:paste`,
- [ ] determine the correct renderer from the original editor to this new editor (use before and after `grammar` and `extension` from `filepath` to determine the correct renderer in this specific case)
- [ ] Use the renderer
- [ ] If the result is of type string (source code, not a View such as SpacePen, #47 )
- [ ] Paste the resulting source code

Users can create simply keymaps for the `preview:copy` and `preview:paste` commands and use them as their new source code copy and paste!

Thoughts @ddavison?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the package command entry points for preview:copy and preview:paste, then review the existing renderer behavior and the View case referenced in #47. Done means copying text, grammar, and filepath, selecting the renderer from the source and destination grammar and extension, and pasting string results into the new editor.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, groovy, javascript, objective-c
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.