Bug 500790 - Add ability to open a new editor without file
Summary: Add ability to open a new editor without file
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-03 05:27 EDT by Yauheniy Ratkevich CLA
Modified: 2016-09-05 08:23 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yauheniy Ratkevich CLA 2016-09-03 05:27:13 EDT
It would be great to add an ability to open any editor without file creation (like in Notepad++).
Especially for JSON and SQL.
(File -> New Editor -> Select type/Language)

-- Configuration Details --
Product: Eclipse 4.6.0.20160613-1800 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.platform 4.6.0.v20160606-1342
Comment 1 Patrik Suzzi CLA 2016-09-04 06:59:50 EDT
This is already possible with File > New.. > Untitled Text File

Keyboard shortcurt combo:
Press Ctrl+N, type "unt", and press enter.

Note: if you close without saving, you'll lose the content.
Comment 2 Yauheniy Ratkevich CLA 2016-09-04 07:22:38 EDT
@Patrik, I mean not just a notepad, but an ability to qualify a type of this editor JSON / SQL / JAVA / XML etc.

Otherwise it's almost useless... I have just a Notepad or Sticky Notes
Comment 3 Patrik Suzzi CLA 2016-09-04 10:43:09 EDT
IIUC you want to: Create an Untitled Text File (without saving) and force Eclipse using a specific editor for that file, i.e. the XML or JSON Editor. 

To do the same now, you first need to save; then you can choose the editor, i.e. Open With > XML Editor.

Notes: 
- Notepad++ just does lightweight editing, activating syntax highlighting, when you select the Language Type. 
- Eclipse is more advanced and, If I Recall Correctly, the "classic editors" are working against a file-based buffer.

Assuming we want to proceed with this implementation, I see two options: 
(1) Instruct the editors to use an in-memory buffer, instead of a file one. 
(2) Implement this using the upcoming Eclipse Generic editor; that seems the right choice for lightweight editing. 

Adding Dani and Mickael in c/c as they can correct me and guide to the right direction.
Comment 4 Mickael Istria CLA 2016-09-05 03:05:13 EDT
Fixing this seems a bit tricky as Patrick identified. And creating a new file for edition seems pretty natural, and the current situation has only for drawback to create a file. So I'm not sure this is worth being worked on at the moment.

The workaround is just to create a file. In general, it's useful to get content persisted anyway, even for draft work.
Comment 5 Yauheniy Ratkevich CLA 2016-09-05 03:11:20 EDT
(In reply to Patrik Suzzi from comment #3)
(In reply to Mickael Istria from comment #4)

Yes, you've understood me correctly.

As for this: 
"To do the same now, you first need to save; then you can choose the editor, i.e. Open With > XML Editor."

Yes, I can. But here I still need to create a file.

You can do it for some very popular formats, like JSON. Just JSON editor.
If you do it, it will be really a killer-feature in Eclipse.

For my understanding, you can create TEMPORARY file (like "7a8f1f2.json", somewhere in 'C:\Temp' or anywhere else) and work with it, and delete it on Editor closing.
Comment 6 Mickael Istria CLA 2016-09-05 03:23:39 EDT
(In reply to Yauheniy Ratkevich from comment #5)
> If you do it, it will be really a killer-feature in Eclipse.

I have some serious doubts about it ;)
Having users doing  File > New > JSon Editor (selection) rather that doing File > New > text.json (freetext) is not much better because:
* there are as many steps to go
* Both are equally simple/difficult to discover and understand
* freetext allows to create any file type then to choose or discover the best editor, without restriction; whereas selection introduces a set of supported types
* In most cases, people do want to save their file, so asking them for the name 1st is saving them one step in saving later

Do you have a user-story to share when the workflow you propose would be considerably better than the current one?
Comment 7 Yauheniy Ratkevich CLA 2016-09-05 04:37:15 EDT
(In reply to Mickael Istria from comment #6)
> (In reply to Yauheniy Ratkevich from comment #5)

I may explain, why I wasn't so lazy and even opened this discussion.

It's not the secret that almost all users of Eclipse are web-developers with stack Java+JS/HTML.

And during working on the project, each day I'm facing with JSON data: in requests, responses, in logs (yes, it's very comfortable to have JSON-logs), mock data, data in my DB, etc. 

And each time I need to format it, have outline, search for some fields. And I don't want to create any freaking file somewhere in my project or workspace.

It shouldn't be somewhere deep in Menus. It can be somewhere on the top. For example Window->New JSON Editor.

And I don't think, that it needs huge refactoring to create temporary file for it, doesn't it?

I've found plugin, that have such option:
http://marketplace.eclipse.org/content/json-tools 

But it would be good to see native JSON editor there.
Comment 8 Patrik Suzzi CLA 2016-09-05 07:41:36 EDT
Mickael, if the classic editors are not made for lightweight editing, we could create a new eclipse project that ships a set of lightweight editors, based on the Generic editor (IIRC you and Sopot are working on this, adding him in c/c). 

As pointed by Yauheniy, we probably need few fundamental editors. As example XML, JSON, Java, JavaScript, HTML and SQL.

Hence, for each of the above, we should add language server support, and I think there are already some options, i.e.
- Java: https://projects.eclipse.org/proposals/jdt-language-server
- JSON: once license is cleared, we could use the @code / or we can ask the JSDT team.
For the servers not available, we could contribute new ones:
- JavaScript: this can be contributed by the JSDT team, via Chromium
- XML: we could write a new one (I'm available)
- HTML and SQL: write a new one, as for XML. 

(There are a lot of companies working on Language Servers, and after a language server is available, we are also closer to offer that service on the web)

Then, we could ship this set of lightweight editors as an Eclipse Project, and add them to any Eclipse distribution. 
(perhaps in future, using language servers, we can offer a web edition of Eclipse?)

That could be really cool, especially if we can get guidance from the Eclipse Platform Text team. 

WDYT?
Comment 9 Mickael Istria CLA 2016-09-05 07:48:20 EDT
(In reply to Patrik Suzzi from comment #8)
> Mickael, if the classic editors are not made for lightweight editing, we
> could create a new eclipse project that ships a set of lightweight editors,
> based on the Generic editor (IIRC you and Sopot are working on this, adding
> him in c/c). 

Here, it's not a matter of lightweight or not. Yauheniy seems to actually want the current editors, so nothing to consider on this topic.
The requested change is a workflow additio: additionally to the entry to select a file to create and then get an editor, user wants an entry to directly select an editor to open.

> As pointed by Yauheniy, we probably need few fundamental editors. As example
> XML, JSON, Java, JavaScript, HTML and SQL.
> Hence, for each of the above, we should add language server support,

I didn't read this in Yauheniy's comments, I believe you're over-interpreting and the other parts of your answers do not relate at all with the original request.
(Note that I don't disagree with you on those other parts, I'm just trying to keep focused request on the bug tracker)
Comment 10 Patrik Suzzi CLA 2016-09-05 08:23:08 EDT
I think I see what you mean:

Ctrl+N > Untitled File > new UI > Editing

The new UI allow you to keep the Eclipse generic editor, or to choose any of the registered editors to edit the new file.