Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Paste code snippet in Ceylon Explorer package should create a .ceylon file #1225

Closed
PhiLhoSoft opened this issue Jan 28, 2015 · 8 comments
Closed
Labels
Milestone

Comments

@PhiLhoSoft
Copy link

A trick I appreciate in Eclipse Java is that I can copy a code snippet in a file, then select a package (eg. in the Project Explorer) and paste the snippet. Eclipse will create a .java file with the snippet in it.
If I copied a whole class, the new file will have the class name and a package declaration is added.
Otherwise, it names the file Snippet and creates a class of same name where it pastes the code.

I tried this in the Ceylon Explorer (out of habit), and I got... a Snippet.java file with a Java class declaration!

It would be nice if the Ceylon plugin could detect such action and just create a Snippet.ceylon file with the code pasted raw (or in a class?) in it. Or be a little smarter and detect if we paste a class or interface, to name the file after the (first) found item.

@gavinking
Copy link
Contributor

I guess what is needed for this one is a customized CCPActionGroup at CeylonNavigatorStandardActionsProvider.java:69. Probably not super-hard.

@gavinking gavinking added this to the Ceylon 1.3 milestone Mar 21, 2015
@gavinking
Copy link
Contributor

Yep: it's actually PasteAction.TextPaster that does this work for Java.

gavinking added a commit that referenced this issue Mar 21, 2015
gavinking added a commit that referenced this issue Mar 21, 2015
@gavinking gavinking modified the milestones: Ceylon 1.2, Ceylon 1.3 Mar 21, 2015
@gavinking gavinking self-assigned this Mar 21, 2015
@gavinking
Copy link
Contributor

@PhiLhoSoft I have implemented this. WDYT?

@PhiLhoSoft
Copy link
Author

Great! Thanks for this. (and for the autocompletion on camel case too).
As soon as it is available in an update (sorry, no time to build the IDE by myself), I will try it and report feedback (or just use it happily if working flawlessly... 😄).

gavinking added a commit that referenced this issue Mar 22, 2015
@DiegoCoronel
Copy link
Contributor

Hi Gavin, i tried to copy 3 files (the file .ceylon, not the content) to another package and now it opens the popup for the snippet, maybe thats not a intended behavior.

gavinking added a commit that referenced this issue Mar 23, 2015
@gavinking
Copy link
Contributor

@DiegoCoronel hopefully should be fixed now.

@DiegoCoronel
Copy link
Contributor

checked, thanks,

@gavinking
Copy link
Contributor

Closing. @PhiLhoSoft can reopen if there's something wrong with it.

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

No branches or pull requests

3 participants