Coder Social home page Coder Social logo

snipeditor's Introduction

SnipMatch

This project has moved to the eclipse repository: http://git.eclipse.org/c/recommenders.incubator/org.eclipse.recommenders.snipmatch.git/

SnipEditor

Working maven build and most of the JFace grammar.
The update site can be found here[1]. In order to use, please follow the instructions provided
in the update site readme file. It does not work directly from eclipse IDE(yet).

This build supports syntax for class declarations, method declarations, attribute declarations and assignments and
basic operations. Examples can be found in the update site repository.
<br> In order to open the projects in eclipse, simply clone the repo on the local computer and import the projects
in eclipse. You will also need to generate the language artifacts.

In order to build this, follow the steps:
(1)clone the repo to the local computer
(2)open the command line
(3)go to ../org.eclipse.recommenders.snipeditor.releng
(4)run the command mvn clean install.

The preference page and the view

The prefetence page can be used to set the locations of the snippets. This can be accessed from
Window -> Preferences -> SnipMatch Preferences.

In order to set it up:<br>
<br>
(1) Set the location of the local snippets in the <i>Local Snippets Directory</i> path location <br>
(2) Click the <i>Generate Index File</i> button.<br>
(3) Chose the index file in its alocated path.<br>
<br>
After the preference page is set up, you can access the local snippets through the snippets view:<br>
<br>
(1) Go to <i>Window -> Show View -> Other -> Other -> Snippets View </i> and open it.<br>
(2) If the snippets do not appear in the list, press the refresh button.<br>
(3) The snippets ahould be visible now, so in order to edit them, just press double click on the one <br>
to be edited :) <br>
<br>

The Editor

In order to allow all functionalities of the editor, the files are copied in the local workspace.
Therefor, a new project will be created in the workpsace with the snippets. Here, .cSnip files
will be created from the code in the .json files.

Some instructions on how to use the editor:

(1) imports have the following format:

~ ${import(library.you.want.to.import.*)}
~ ${import(library.you.want.to.import.specificClass)}

(2) variables and attributes can be declared like in java(with a simple name) or using one of the following expressions:

~ varName
~ ${varName}
~ ${freeName(varName)} / ${varName:freeName(varName)}
~ ${newName(varName)} / ${varName:newName(varName)}

Each of the last three will be translated to ${varName}, so the variable / attribute will be accessed
through this id (new ids can be introduced at any time if needed)

(3) only java types are supported! in order to use a type, you must explicitly import it(except for basic String, Integer, etc.).
Some quick fixes will be available to ease codding.
Types can be accessed in the following manner:

~ type_name
~ ${elemType(type_name)} / ${typeName:elemType(type_name)}

Both access the same type ( type_name ). Maybe somewhere in the future, abstract types that will
be deduced from context will be availabe.(e.g.: ${some_Array_type})

(4) the rest of the expressions are similar to java, except for the for loop expression which supports only
the iterator syntax, the other one will come in a future update.


An example:
${import(org.eclipse.xtext.xbase.lib.*)}
${import(java.util.Locale.Builder)}

class c1{ public void m1(){ String[] a=new String [2]; ${elemType(Builder)} ${freeName(b)}=new Builder(); ${b}.addUnicodeLocaleAttribute("MyBuilder"); System.out.print(a); if(a instanceof String[]){ super.toString(); } for(${s} : a){ System.out.println(${s}); ${cursor} } while('${dollar}' == '$' ){ System.out.println(a); } } }

[1]https://github.com/stefanprisca/SnipEditor_UpdateSite

4ce47ddfa933575c35a555a9ead1083b71151625

snipeditor's People

Contributors

stefanprisca avatar lakjeewa avatar fsteeg avatar johannesdorn avatar

Watchers

James Cloos avatar gokul avatar

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.