Giter VIP home page Giter VIP logo

yangster's Introduction

Yangster

A tool for working with the YANG language.

Development

Open in Gitpod

Manual Setup

Install yarn. Clone and build yang-lsp.

Clone and Build Yangster

Requirements: Python 2.x, Java 8.x, node 8.x, yarn >1.0.2, a C++ compiler, curl, unzip.

git clone --recursive https://github.com/theia-ide/yangster.git && \
cd yangster && \
yarn

For incremental development use

yarn watch

Build on Windows

If you build on Windows, we recommend to install windows build tools, which includes Python and th VS C++ compiler.

npm install --global --production windows-build-tools

UNIX like shells like git-bash or Cygwin alsoe include curl and unzip as command line tools.

Run Yangster

The browser version: Run

yarn rebuild:browser && \
cd yangster-app && \
yarn start

Then point your browser to http://localhost:3000.

The Electron version:

yarn rebuild:electron && \
cd yangster-app-electron && \
yarn start

Connecting the LSP through a Socket

For development it is better to connect to the running LSP through a socket. For that you need to start the yangster-app using

cd yangster-app && \
yarn run start:backend:socket

It will try to connect to the yang-lsp server that you now need to start from within Eclipse by launching RunSocketServer.

Publishing Yangster

Each change on master triggers a build on Jenkins against Theia next. The resulting package is automatically published to npm with the next tag.

For a release (or when Theia releases a new major), we have to build against Theia latest. To achieve that

rm yarn.lock                 # make sure to re-install deps
node theia-version.js latest # set all dependencies to Theia to 'latest'
yarn                         # rebuild (don't forget!)
yarn run publish:latest      # publish
rm yarn.lock                 # make sure to re-install deps
node theia-version.sh next   # reset Theia dependencies to 'next'
yarn                         # make sure yarn-lock is reset to 'next'
git add -A
git commit -m 'Bumped version number'

yangster's People

Contributors

corneliusludmann avatar dhuebner avatar epatpol avatar huyuwen avatar jankoehnlein avatar jbicker avatar kittaakos avatar marcdumais-work avatar spoenemann avatar svenefftinge avatar uniibu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yangster's Issues

Export diagram does not let the user choose a name/location

Diagram ->Export: we need to propose a dialog and let the end-user choose a name and a location about the export diagram. Currently, it creates a file under the folder of the selected diagram and create a file with the extension ".svg". This could be the proposed default name for the end-user.
peek 2017-10-23 export

Diagram center command do not show the center of the diagram

Diagram -> Center: Seems the command does different things depending where the last user focus was in the diagram. It seems it center the last module the user selected. No indication on the diagram to show what was the last user selection.
peek 2017-10-23 center

Initial Setup

Similar to the Theia/Sprotty example, we need

  • a browser application for Yangster
  • connects to yang-lsp
  • has syntax coloring, bracket matching, etc. for YANG
  • allows opening a class diagram on yang files

Dockerfile doesn't work anymore

I tried building it and I got a maven error after cloning xtext-jflex. Looking at the other project it seems it recently switched from maven to gradle, so that might explain it.

[ui][enhancement]Resize handle

Enlarge the diagram: we can use the mouse wheel to en-large/reduce the diagram, but can we use the left click on a corner of the diagram and enlarge/reduce it to the end-user preferred size ??
peek 2017-10-23 resizehandle

Add an opener for SVG files

Try to open the exported diagram with the option "Files -> Open with -> Yang Diagram" ==> open an editor which does not show the diagram at all.
peek 2017-10-23 exportopen

Can't start a diagram with yangster-app

I get:

[2018-02-02T12:10:41.311Z] ERROR: Theia/11950 on elxa4wqvvz1: 07:10:41 widget-0_sprotty Viewer: element not in DOM: [ 'widget-0_sprotty' ]

Ideas ?

[diagram] DoubleClick open the code editor and not the diagram editor

From the workspace navigator, double click on a file open the code version of the selection. If I selected the "Open With -> Yang Diagram" previously, I would expect the second time I open the file to use the "Yang Diagram" and not the code editor. May we can have a preference for "Double Click opening the editor"
peek 2017-10-23 defaultdoubleclick

Error after installing theia-yang-extension from npm

  • Run theia from the sources (electron or browser)
  • install theia-yang-extension using the extension manager
  • reload

The screen stays black. On the console I see

index.js:50 Error: Cannot apply @injectable decorator multiple times.
    at injectable.js:8
    at DecorateConstructor (Reflect.ts:1090)
    at Object.decorate (Reflect.ts:284)
    at _decorate (decorator_utils.js:42)
    at Object.decorate (decorator_utils.js:55)
    at Object.defineProperty.value (widget.ts:13)
    at __webpack_require__ (bootstrap 0c054091550f5e565229:688)
    at fn (bootstrap 0c054091550f5e565229:109)
    at Object.m (index.ts:8)
    at __webpack_require__ (bootstrap 0c054091550f5e565229:688)

The target is the class Widget.

Missing diagram indication of user selection before selecting "Fit to screen"

Diagram -> Fit-to-screen : Seems the command does different things depending where the last user focus selection was in the diagram. Sometimes, we seem the whole diagram, sometimes, we see only one box within the diagram. It looks like depending the last time you click on the diagram, it enlarge this section of the diagram to fit the screen, but there is no indicator in the diagram showing what is being "selected"
peek 2017-10-23 fittoscreen

Namespace char replacement "-" by "/"

If you select the file: "example-3-a.yang" , hover the diagram will open a dialog with the information and the Namespace for the file will be "example-3/a". Why do we replace the last"-a" by "/a" and the end?
peek 2017-10-23 hovernamespace

Cannot open diagram for mytest.yang

Only works when the LSP is started in socket mode.

Exceptions is:

Error while processing build resultsjava.util.concurrent.CompletionException: java.lang.reflect.UndeclaredThrowableException
   at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
   at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
   at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:659)
   at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632)
   at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
   at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962)
   at org.eclipse.xtext.ide.server.concurrent.RequestManager.lambda$null$0(RequestManager.java:78)
   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.UndeclaredThrowableException
   at com.sun.proxy.$Proxy31.notify(Unknown Source)
   at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.invoke(EndpointProxy.java:74)
   at com.sun.proxy.$Proxy33.accept(Unknown Source)
   at io.typefox.sprotty.server.xtext.DiagramLanguageServerExtension.lambda$initializeDiagramServer$2(DiagramLanguageServerExtension.java:127)
   at io.typefox.sprotty.api.DefaultDiagramServer.dispatch(DefaultDiagramServer.java:111)
   at io.typefox.sprotty.api.DefaultDiagramServer.submitModel(DefaultDiagramServer.java:194)
   at io.typefox.sprotty.api.DefaultDiagramServer.updateModel(DefaultDiagramServer.java:137)
   at io.typefox.sprotty.server.xtext.DiagramLanguageServerExtension.lambda$updateDiagram$11(DiagramLanguageServerExtension.java:228)
   at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:656)
   ... 8 more
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.invoke(EndpointProxy.java:96)
   ... 17 more
Caused by: org.eclipse.lsp4j.jsonrpc.json.InvalidMessageException: An element of the message has a direct or indirect reference to itself.
   at org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.consume(ReflectiveMessageValidator.java:49)
   at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.notify(RemoteEndpoint.java:95)
   ... 22 more

Need accelerator key to open the Yarn Diagram

In the "Yang Diagram" navigator, double click open the "code editor", but there is other way to open the diagram directly from the navigator and open the "Yarn Diagram" than selecting through the menu selection. There is no accelerator key.

[electron] Provide a downloadable and executable yangster application

TODOs:

  • Currently, the yangster/yangster-app-electron/package.json cannot be used as we do not have a solution for dealing with symlinks with the electron-builder. (Alternatively, we could provide another package.json and use that for the bundling phase.) (See the attached package.json.)
  • LS does not start inside the packaged application. The executable path is hard-coded in the the backend extension: ../node_modules/theia-yang-extension/build/yang-language-server/bin/yang-language-server. After the bundling, the module that defines the above mentioned executable path is inside: yangster-electron.app/Contents/Resources/app/node_modules/theia-yang-extension/lib/backend/backend-extension.js. One level up, no node_modules folder exists, hence it cannot work. (Fixed with 7e7e55b)
  • Update the yarn.lockso that it can pull the fix for the electron issue in Windows due to the AMD loader. Current version of @theia/monaco is '0.3.0-next.218d2c46': '2017-10-30T13:15:50.681Z',. It should be '0.3.0-next.db76dbf1': '2017-11-02T11:18:13.414Z'. (#43) (Fixed with 687b37f)
  • LS does not start on Windows. I guess, we need the .bat file extension when starting the process. (Fixed with 91d1677)
  • Nice icons would be great. (#42 (comment))
  • One should be able to browse the desired instllation location when using the nsis installer on Windows.

package.json:

{
  "name": "yangster-electron",
  "version": "1.0.0",
  "description": "Yangster Electron",
  "main": "src-gen/frontend/electron-main.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/theia-ide/yangster.git"
  },
  "theia": {
    "target": "electron"
  },
  "build": {
    "appId": "yangster-electron.app",
    "productName": "Yangster",
    "files": [
      "src-gen/**/*",
      "lib/**/*",
      "node_modules/**/*",
      "package.json"
    ],
    "directories": {
      "buildResources": "resources"
    },
    "asar": false,
    "publish": null,
    "nsis": {
      "menuCategory": true,
      "oneClick": false,
      "perMachine": true,
      "installerHeaderIcon": "resources/icon.ico",
      "allowToChangeInstallationDirectory": true,
      "runAfterFinish": false
    },
    "mac": {
        "target": "dmg"
    }
  },
  "scripts": {
    "build": "theia build",
    "package": "build",
    "package:all": "build -mwl --x64",
    "postinstall": "npm run build && npm run dist",
    "dist": "npm run build && npm run package"
  },
  "keywords": [],
  "author": "typefox <[email protected]>",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/theia-ide/yangster/issues"
  },
  "homepage": "https://github.com/theia-ide/yangster#readme",
  "dependencies": {
    "@theia/core": "next",
    "@theia/editor": "next",
    "@theia/filesystem": "next",
    "@theia/git": "next",
    "@theia/languages": "next",
    "@theia/markers": "next",
    "@theia/monaco": "next",
    "@theia/navigator": "next",
    "@theia/preferences": "next",
    "@theia/process": "next",
    "@theia/terminal": "next",
    "@theia/typescript": "next",
    "@theia/workspace": "next",
    "theia-yang-extension": "0.1.2",
    "xterm": "^2.9.2"
  },
  "devDependencies": {
    "@theia/cli": "next",
    "electron-builder": "^19.30.2"
  }
}

Steps to build:

yarn

Error adding Theia git extension as dependency

Trying to fix #46, I encountered this issue.
I gave this a try: I added a dependency to the theia git extension in package.json. It builds fine but there's an exception in the frontend application, preventing it from starting:

(see the change here: marcdumais-work@5d4840d )

index.js:44 Error: Cannot apply @injectable decorator multiple times.
    at injectable.js:8
    at DecorateConstructor (Reflect.ts:1090)
    at Object.decorate (Reflect.ts:284)
    at _decorate (decorator_utils.js:42)
    at Object.decorate (decorator_utils.js:55)
    at Object.defineProperty.value (widget.ts:13)
    at __webpack_require__ (bootstrap 57bab4548ecc5c842def:688)
    at fn (bootstrap 57bab4548ecc5c842def:109)
    at Object.c (index.ts:8)
    at __webpack_require__ (bootstrap 57bab4548ecc5c842def:688)
module.exports.Promise.resolve.then.then.then.then.then.then.then.then.then.then.then.then.then.then.then.then.catch.reason @ index.js:44
Promise rejected (async)
(anonymous) @ index.js:41
__webpack_require__ @ bootstrap 57bab4548ecc5c842def:688
Object.defineProperty.value @ bootstrap 57bab4548ecc5c842def:789
(anonymous) @ bootstrap 57bab4548ecc5c842def:789

outline view not populated as expected

Looking at the outline view in Yangster, using the "mytest.yang" example source file, it seems that the view is only partially populated, having a single entry: "my-type". Bug?

image

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.