Coder Social home page Coder Social logo

de-jcup / eclipse-hijson-editor Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 1.0 2.14 MB

Highspeed JSON editor

Home Page: https://marketplace.eclipse.org/content/hijson-editor

License: Apache License 2.0

HTML 2.40% Java 95.17% Shell 2.31% CSS 0.13%
json editor eclipse fast speed

eclipse-hijson-editor's Introduction

Java CI with Gradle

About

HiJSON Editor (highspeed JSON eclipse editor plugin) is a specialized eclipse plugin to handle bigger JSON files in a very performant /fast way.

The project page can be found at https://github.com/de-jcup/eclipse-hijson-editor

Why is this editor faster than other eclipse plugins for JSON editor?

  • One liners having more than x (x=currently 1000 characters but not at least 5 new line characters, will be automatically pretty printed. This will extremely speed up editor behaviour!
    (This DOES CHANGE the file inside editor - but not on disk, except when you save it…​)

  • Outline will be disabled per default and must be enabled when needed (in outline view), so no unnecessary tree build

  • Some optimizations in rendering etc.

  • Special document handling, partitioning etc.

  • Uses https://github.com/FasterXML/jackson to do JSON operations, so very fast

eclipse-hijson-editor's People

Contributors

de-jcup avatar tobix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

udow

eclipse-hijson-editor's Issues

Enable outline and outline linking per default

After implementing #10 the outline will be very fast and the linking does work.

The default shall be that linking and also the outline is enabled per default.
Existing installation shall be upgraded as well (formerly the default was to false and so users would not get the new feature out-of-the-box)

Provide link between outline and editor

Situation

Currently (1.0.0) there is no link sync between editor and outline. So outline is just to view structure.

The reason is that Jackson library does not provide the pos information at default scan.

Wanted

As a developer I want to doubleclick on the outline entry and the editor shall open the text position in editor

Solution

Jackson data model parsing is very fast. To change this library etc. would reduce speed (IMHO).
I think the most simple way is to parse the document again, when there is a double click and fetch the position then.

Possibilities:

  • One solution could be to implement an extreme simple JSON parser and checkout the position from outline tree.
  • Another way would be to use another JSON parser library
  • Use Jackson library, but in another way (maybe stream like ?)

Files outside project are not syntax highlighted

Situation

When I drag and drop a file (its not inside a project but outside workspace) into editor area, the file is loaded with hijson editor, outline works but no syntax highlighting:

image
(remark: this happens also with File -> load...)

When I copy it to a project and load it "the normal way", syntax highlighting works:
image

Wanted

Syntax highlighting shall work also for files outside the workspace

Formatter deletes entries for duplicated keys

The pretty print formatter (Source/Format JSON or use ctrl-shift-F) deletes entries from dicts.

All dict entries with duplicate keys are removed.

For instance, enter this

{
  "a" : 5,
  "b" : 3,
  "a" : 7
}

now press ctrl-shift-F
You get

{
  "a" : 7,
  "b" : 3
}

Deleting entries -which is probably your latest edits - is completely inacceptable. For me I will immediately install HiJSON until this is fixed..
This may happen far out of sight
There is no warning at all.
This happens frequently, because the easiest way to create a new entry is to copy an existing one and then start editing it.

Remove duplicated errors in editor

Situation

Errors are shown multiple times inside editor

At the first line and also at the occurrence of the problem.

Wanted

Only one marker at the dedicated position of the problem

Outline shall provide delete function

Situation

It often happens, that I have a larger block of data I want to get rid of in a JSON file. E.g. to shrink existing bigger data to a simple example

Wanted

Mark a block inside JSON and just pres DEL and its gone, without syntax problems I have to fix after this

Solution

Inside the outline view, users can already select multiple elements. There shall be an option to delete those selected parts.

Provide thymeleaf templating

Situation

{[#th:block th:with="sarifSupport=${new org.zaproxy.addon.reports.sarif.SarifReportDataSupport(reportData)}"]
   "runs": [
      {
         "results": [ [#th:block th:each="sarifResult, sarifResultState: ${sarifSupport.results}"]
...
[/th:block]],

shows an example for a thymeleaf template (see https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#textual-template-modes)

Unfortunately we have no outline here inside the editor and an error is shown because not valid JSON (what is correct).

Wanted

  • auto detect thymeleaf (when thymeleaf support is enabled in preferences)
  • no error marker
  • working outline

Solution

  • when it is a thyme leaf template, the parsed document shall not be the origin but - like in yaml editor for go templates - a tampered JSON document, where all thymeleaf parts are simply removed/replaced by spaces

Example1

[# th:each="message : ${messages}"]
                "message": {
                  "text": [[${sarifResult.message.text}]]
               },
[/]

will be replaced internally to


                "message": {
                  "text": []
               },

Example2

[#th:each="message : ${messages}"]
                "message": {
                  "level": "[(${sarifResult.level.value})]",
               },
[/th:each]

will be replaced internally to


                "message": {
                  "level": ""
               },

Detection howto

Everything starting with
[# marks a thymeleaf beginning tag, terminated by ]
[/ marks a thymeleaf end tag, terminated by ]

Provide JSON Schema-Support

https://github.com/java-json-tools/json-schema-validator

Schemafiles should be very simple to assign:

a) context menu "Set Yaml/JSON Schema"
b) main toolbar via a dedicated button/command

There shall a dialog appear with
a) List of all wellknown schemas
b) Show current selected schema (if selected)
c) Have a "NONE" entry as well
d) show all schemas available at ~/.de-jcup.schemas/ (or still ~/.yaml-editor/schemas/)
e) provide selection
f) provide an import of new schemas
g) The possiblity to add
h) have standard schemas "on board"

this should be same implementation as in de-jcup/eclipse-yaml-editor#61

Index out of bounds exception when reading json report file

When opening
https://github.com/Daimler/sechub/blob/develop/sechub-adapter-netsparker/src/test/resources/netsparker_v1.0.40.109_new_scan_output.json
with HiJSON Editor 1.0.0 I got following error:

java.lang.StringIndexOutOfBoundsException: String index out of range: 1810
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
	at java.base/java.lang.String.charAt(String.java:712)
	at de.jcup.hijson.document.JSONFormatSupport.formatJSONIfNotHavingMinAmountOfNewLines(JSONFormatSupport.java:96)
	at de.jcup.hijson.document.JSONFormatSupport.formatJSONIfNotHavingMinAmountOfNewLines(JSONFormatSupport.java:79)
	at de.jcup.hijson.document.HighspeedJSONDocument.set(HighspeedJSONDocument.java:18)
	at org.eclipse.jface.text.AbstractDocument.set(AbstractDocument.java:1123)
	at org.eclipse.ui.editors.text.StorageDocumentProvider.setDocumentContent(StorageDocumentProvider.java:152)
	at org.eclipse.ui.editors.text.FileDocumentProvider.setDocumentContent(FileDocumentProvider.java:399)
	at org.eclipse.ui.editors.text.StorageDocumentProvider.createDocument(StorageDocumentProvider.java:225)
	at de.jcup.hijson.document.HighspeedJSONFileDocumentProvider.createDocument(HighspeedJSONFileDocumentProvider.java:39)
	at org.eclipse.ui.editors.text.FileDocumentProvider.createElementInfo(FileDocumentProvider.java:684)
	at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(AbstractDocumentProvider.java:395)
	at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4182)
	at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:262)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1479)
	at org.eclipse.ui.editors.text.TextEditor.doSetInput(TextEditor.java:153)
	at de.jcup.hijson.HighspeedJSONEditor.doSetInput(HighspeedJSONEditor.java:378)
	at org.eclipse.ui.texteditor.AbstractTextEditor.lambda$1(AbstractTextEditor.java:3172)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:436)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
	at org.eclipse.ui.internal.WorkbenchWindow.lambda$7(WorkbenchWindow.java:2353)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2351)
	at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3189)
	at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3214)
	at de.jcup.hijson.HighspeedJSONEditor.init(HighspeedJSONEditor.java:493)
	at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:353)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:344)
	at jdk.internal.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:999)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:964)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:405)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:332)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:999)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:765)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:730)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:714)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.lambda$0(PartServiceImpl.java:104)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:5895)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:219)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:170)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:188)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:659)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:623)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:786)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:400)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1262)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3195)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3100)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3098)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3068)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3059)
	at org.eclipse.search.internal.ui.text.EditorOpener.showWithReuse(EditorOpener.java:120)
	at org.eclipse.search.internal.ui.text.EditorOpener.open(EditorOpener.java:46)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage.open(AbstractTextSearchViewPage.java:465)
	at org.eclipse.search.internal.ui.text.FileSearchPage.handleOpen(FileSearchPage.java:243)
	at org.eclipse.search.ui.text.AbstractTextSearchViewPage$2.open(AbstractTextSearchViewPage.java:751)
	at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:802)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:799)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1118)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:270)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:310)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5785)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5048)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4526)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1434)

Outline should be as much as failure tolerant as possible

Situation

Currently the outline is not rendered when the JSON has some flaws (e.g. comments)

Wanted

If it's possible to accept the textfile as JSON the outline shall render it

Solution

Use a dedicated "accept all" jackson factory where model creation is as tolerant as possible.

Fix editor clone problem

When editors are cloned the data models are not in sync. Solve as done for other de-jcup plugins (shared document provider)

Provide nonfreezing import/loading of big files inside editor

Situation

Currently when loading a bigger JSON file (e.g. 15MB) the editor/IDE freezes for approx. 3-5 seconds.

Wanted

Opening such files must show a progress in progress view, the document inside the editor shall show an alternative text
(maybe with a progress info as well) and the IDE may NOT block/freeze.

Solution

Open - idea is to create own thread or an eclipse job to handle this. After job laoding (model building, HiJSONDocument created etc.) there is just a document switch and the editor shows up the content.

Inside jcup plugin "Junit Server Result" there is a similar approach while analyzing the log files and create relvant snippets for time period...

Add option to allow unquoted control characters in strings

Situation

There is a deprecated possibility to use unquoted control chars :
JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS

which is currently not supported by editor

Wanted

Some people need this - so we add option to allow unquoted control characters in strings

It shall be configurable in preferences and disabled per default.

Move plugin update-site to another location (bintray is in sundown)

Because of bintray sundown - see de-jcup/eclipse-asciidoctor-editor#333 for details - the plugin must be hosted somewhere else.

Will include

  • new infrastructure
  • change update site location
  • change way of deployment - remove old bintray auto deploy script

With de-jcup/p2-updatesite-github-pages-automation#1 there is now a dedicated repository which shall be the base for bugfixes, enhancements etc. related to the new deploy.sh script

Improve dark theme handling at startup

A fresh start with dark theme enabled should use dark theme colors out of the box.
At the moment user must always open the preferences page and press "apply dark theme defaults" what is cumbersome.

It seems plugin xml does miss the css dark theme contribution - look into asciidoctor editor plugin how to enable

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.