Code Monkey home page Code Monkey logo

vscode-epics's Introduction

vscode-epics, EYE (Enlight Your Epics)

This VS Code extension provides syntax highlighting for EPICS database, template, substitutions and startup files, and streamdevice prototype files.

1. Features

  • Syntax highlighting for:
    • database and template files (.db, .dbd and .template)
    • substitutions files (.substitutions, .sub, and .subs)
    • startup files (.cmd and .iocsh)
    • streamdevice prototype files (.proto)
    • SNL files (.st extensions are considered as .c extension and some keywords are highlighted)

Syntax highlighting

  • Snippets for:
    • database and template files (.db and .template)
    • substitutions files (.substitutions, .sub, and .subs)
    • startup files (.cmd and .iocsh)
    • C source code
    • streamdevice prototype files (.proto)
    • SNL files (over charge of your .c extension)
    • we-test (scenario and suite)
Tips: to see all the available snippets per file type, write "epics." and a list will show up (file has to have a known extension).
  • Compilation facilities

  • Linter for:

    • database and template files
    • substitutions files
    • startup files
    • streamdevice prototype files
    • SNL files

2. Requirements

VS Code 1.5 or newer version.

3. get all the fields of the EPICS database

  • ".db": to select .dbd and .dbd.pod files
  • commun:
$ cat <path_to_epics-base>/src/ioc/db/*.db*  | grep 'field(' | tr "(," " " | awk '{print $2}' | tr "\n" "|" | sed 's/.$//'
  • specific:
$ cat <path_to_epics-base>/src/std/rec/*.db* | grep 'field(' | tr "(," " " | awk '{print $2}' | tr "\n" "|" | sed 's/.$//'

4. useful links

5. create a new extension version

  1. commit changes and close corresponding github issues
  2. report in downloadTracking.ods the number of download with the date and the version
  3. update CHANGELOG.md
  4. check README.md
  5. check version in package.json
  6. create a package with vse: $ vsce package # generate vsix file
  7. create the git tag: git tag -a x.x.x -m "..."
  8. push to server git push origin --tags
  9. on github, create a new release
  10. publish the extension on the vscode marketplace (rights are limited to @nsd and @vnadot) 1. manually 2. via CLI. I didn't manage to make it work yet, issue with the token "requires an Personal Access Token").
  11. post a message on the EPICS [techtalk)[https://epics.anl.gov/tech-talk/2020/msg01930.php]. You can do that by answering by email.

7. create a gif for the documentation

https://github.com/phw/peek

8. Extension Settings

None yet!

9. Known Issues

See gitlab issues.

10. Credits

11. to do

vscode-epics's People

Contributors

hanak avatar jeonghanlee avatar jjl772 avatar nsenaud avatar timguitediamond avatar vnadot avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-epics's Issues

new snippet files subs

add snippet to subs/substitutions files :

file "file.template"
{
pattern
{ MACRO1, MACRO2}
{"value1","value2"}
}

add ai advanced

  • alarms
  • conversion field: LINR, RVAL, ROFF, EGUF, EGUL, AOFF, ASLO, ESLO, EOFF
  • ?

longout not autocomplete editing .db file

Describe the bug
When editing a .db file, the longout record type does not appear in the autocomplete list. Only epics.field.lolo and epics.field.low

To Reproduce
In the second line of file stubborn.db:

record(ao, "stubborn:A")
record(l)

type a o after the l and view the autocomplete list.

Expected behavior
Expecting longout to appear in the list

Screenshots

Clipboard01

Desktop (please complete the following information):

VSCode -> ./VSCode-linux-x64-stable-x64-1602601238/

Add epics function in cmd

Add some usefull epics function in cmd:
epicsThreadSleep
generalTimeReport

I will come back when I will have more example ;)

use selector for choices

  • use "${3|one,two,three|}" for choice and not eg. ${1:NO_ALARM }${2:MINOR }${3:MAJOR}

https://code.visualstudio.com/docs/editor/userdefinedsnippets
Choice
Placeholders can have choices as values. The syntax is a comma-separated enumeration of values, enclosed with the pipe-character, for example ${1|one,two,three|}. When the snippet is inserted and the placeholder selected, choices will prompt the user to pick one of the values.

add SNL snippet

state name_state{
when {
} state state2
}

pvPut(pv_variable);
pvAssign(pv_variable",pv_name")
pvGet(pv_variable);

peut-être d'autres à voir dans la doc SNL, même si elles ne sont pas compliqués mais l'idée est surtout de pouvoir retrouver les fonctions avec le nom genre epics.snl.*

improve asub_code

add examples to write different variables types (int, float, waveform, ...)

Add macro to records snippets

It can be interesting for macros standard to add standard macro:
Ex:
For the ao for now we have

record(ao, "record_name") {
    field(DESC, "description")
    field(PREC, "3")
    field(EGU,  "Volts")
    field(DRVL, "-10")
    field(DRVH, "+10")
    field(VAL,  "0.000")
}

we could have :

record(ao, "record_name") {
    field(DESC, "description")
    field(PREC, "$(PREC=3)")
    field(EGU,  "$(EGU=Volts)")
    field(DRVL, "$(DRVL=-10)")
    field(DRVH, "$(DRVH=+10)")
    field(VAL,  "$(VAL=0)")
}

Note that following macro could also work. The record can be used directly but less an example than the previous proposition
field(DRVH, "$(DRVH=")

(can work for other records)

Add hightlightning for SNL

"The State Notation Language is a superset of the C language"

So if you can inherit the SNL hightlight from the C hightlightning. It would be perfect !!

Add snl PV Assignment

add following snippet for SNL :

int pvExample;
assign pvExample "{pvExample}";
monitor pvExample;

add modbus snippet type

A appeler epics.record.[type].modbus ou du genre

record(longout, "$(SIGNAL)") {
field(DTYP,"asynInt32")
field(INP,"@ASYN($(PORT) $(OFFSET=0))MODBUS_DATA")
}

record(ai, "$(SIGNAL)") {
field(DTYP,"asynInt32")
field(INP, "@asynMask($(PORT) $(OFFSET) $(NBITS))MODBUS_DATA")
field(LINR,"$(LINR=LINEAR)")
field(EGUL,"$(EGUL)")
field(EGUF,"$(EGUF)")
field(EGU, "$(EGU)")
field(HOPR,"$(EGUF)")
field(LOPR,"$(EGUL)")
field(PREC,"$(PREC)")
field(SCAN,"$(SCAN)")
}
record(ao, "$(SIGNAL)") {
field(DTYP,"asynInt32")
field(OUT, "@asynMask($(PORT) $(OFFSET) $(NBITS))MODBUS_DATA")
field(LINR,"$(LINR=LINEAR)")
field(EGUL,"$(EGUL)")
field(EGUF,"$(EGUF)")
field(EGU, "$(EGU)")
field(HOPR,"$(DRVH)")
field(LOPR,"$(DRVL)")
field(DRVH,"$(DRVH)")
field(DRVL,"$(DRVL)")
field(PREC,"$(PREC)")
}
record(bi,"$(SIGNAL)") {
field(DTYP,"asynUInt32Digital")
field(INP, "@asynMask($(PORT) $(OFFSET) $(MASK))")
field(SCAN,"I/O Intr")
field(ZNAM,"$(ZNAM=OFF)")
field(ONAM,"$(ONAM=ON)")
}
record(bo,"$(SIGNAL)") {
field(DTYP,"asynUInt32Digital")
field(OUT, "@asynMask($(PORT) $(OFFSET) $(MASK))")
field(ZNAM,"$(ZNAM=OFF)")
field(ONAM,"$(ONAM=ON)")
field(HIGH,"$(HIGH=0)")
}
record(mbbi,"$(SIGNAL)") {
field(DTYP,"asynUInt32Digital")
field(INP, "@asynMask($(PORT) $(OFFSET) 0xFFFF)")
field(SCAN,"I/O Intr")
}
record(mbbiDirect,"$(SIGNAL)") {
field(DTYP,"asynUInt32Digital")
field(INP, "@asynMask($(PORT) $(OFFSET) 0xFFFF)")
field(SCAN,"I/O Intr")
}
record(mbbo,"$(SIGNAL)") {
field(DTYP,"asynUInt32Digital")
field(OUT, "@asynMask($(PORT) $(OFFSET) 0xFFFF)")
}
record(mbboDirect,"$(SIGNAL)") {
field(DTYP,"asynUInt32Digital")
field(OUT, "@asynMask($(PORT) $(OFFSET) 0xFFFF)")
}

//A tester
record(waveform, "$(SIGNAL)") {
field(DTYP,"asynInt32ArrayOut")
field(INP,"@ASYN($(PORT) $(OFFSET=0))MODBUS_DATA")
field(FTVL,"LONG")
field(NELM,"$(NELM)")
}
record(longout, "$(SIGNAL)LONG") {
field(DTYP,"asynInt32")
field(INP,"@ASYN($(PORT) $(OFFSET=0))MODBUS_DATA")
}

Update details page

Mettre à jour la page d'accueil du plugin, c'est pas à jour par rapport au changelog

Add some highlight word in SNL file

Mot clé type
program keyword
assign keyword
state keyword
entry keyword
monitor keyword
evflag keyword
sync keyword
string type
%% suffixe pour ajouter du C

SNL wrong error detected

avec ce petit programme qui devrait marcher, il indique des errerus types "identifier undefined"

/*

  • C.E.A. IRFU/SIS/LDISC
  • $Id$
  • who when what

  • agaget 15/04/16 created
    */

program SequenceLoad

option -c;
%%#include <string.h>
%%#include <time.h>
%%#include <stdlib.h>
%%#include <stdio.h>

int disconnected;
assign disconnected to "{Experiment}:Seq-Disconnected";

ss ss3
{

state idle
{


	when (pvConnectCount() != pvAssignCount()){
		disconnected=1;
		pvPut(disconnected);
	} state idle

	when(delay(3)){
		printf("wait 3 seconds\n");
		IsSequenceStarted=1;
		pvPut(IsSequenceStarted);
	}state DebutCycle

}

}

Add dbd file

I'm bored so I add some issues for you <3

example: 
# C.E.A. IRFU/SIS/LDISC
#
# $Id: IntegrateWFSupport.dbd 271 2013-11-28 12:57:45Z lussi $
#
# IntegrateWFSupport.dbd
#
# This database definition file contains all the definitions
# provided by the support application module IntegrateWF.
# 
# It is installed by Makefile in <top>/dbd and can be included
# by other dbd files.
# 

# Record types
include "xxxRecord.dbd"

# Devices
device(<record type>,<link type>,<dset name>,"<choice string>")

# Drivers
driver(<drvet name>)

# SNL programs or functions to be invoked from iocsh
registrar(<function name>Registrar)

# Functions for sub or gensub records
function(integrateWF)

# Variables
variable(<variable name>)

@vnadot

add advanced ao

  • OROC
  • conversion field: LINR, RVAL, ROFF, EGUF, EGUL, AOFF, ASLO, ESLO, EOFF
  • alarm fields ?

add epicsType in c asub

epics.type.Float32 -> epicsFloat32 var

avec tous les types EPiCS, trouvable dans le include/epicsType.h de la base (au moins 3.15.4)

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.