Added vim syntax file for SLI #253

Merged
merged 13 commits into from Apr 26, 2016

Conversation

Projects
None yet
5 participants
@sanjayankur31
Contributor

sanjayankur31 commented Mar 2, 2016

Also reorganised directories as @heplesser suggested on the ML

@tammoippen

This comment has been minimized.

Show comment
Hide comment
@tammoippen

tammoippen Mar 3, 2016

Contributor

Hi @sanjayankur31,

You changed the paths of the sli.el.in file, but have not changed it in the build system. Please also change <src>/Makefile.am:70,71 to:

        $(DESTDIR)@PKGDATADIR@/extras/EditorSupport/emacs/sli.el.in > $(DESTDIR)@PKGDATADIR@/extras/EditorSupport/emacs/sli.el
rm $(DESTDIR)@PKGDATADIR@/extras/EditorSupport/emacs/sli.el.in
Contributor

tammoippen commented Mar 3, 2016

Hi @sanjayankur31,

You changed the paths of the sli.el.in file, but have not changed it in the build system. Please also change <src>/Makefile.am:70,71 to:

        $(DESTDIR)@PKGDATADIR@/extras/EditorSupport/emacs/sli.el.in > $(DESTDIR)@PKGDATADIR@/extras/EditorSupport/emacs/sli.el
rm $(DESTDIR)@PKGDATADIR@/extras/EditorSupport/emacs/sli.el.in
@jougs

This comment has been minimized.

Show comment
Hide comment
@jougs

jougs Mar 7, 2016

Contributor

@weidel-p: could you please test this and review the code?
@sanjayankur31: more out of interest: is this based on a vim postscript mode as our emacs mode is, or did you write it from scratch?

Thanks!

Contributor

jougs commented Mar 7, 2016

@weidel-p: could you please test this and review the code?
@sanjayankur31: more out of interest: is this based on a vim postscript mode as our emacs mode is, or did you write it from scratch?

Thanks!

@sanjayankur31

This comment has been minimized.

Show comment
Hide comment
@sanjayankur31

sanjayankur31 Mar 7, 2016

Contributor

@sanjayankur31: more out of interest: is this based on a vim postscript mode as our emacs mode is, or did you write it from scratch?

@jougs : I wrote it from scratch. I'm really new to vim scripting - not even sure if there is a "postscript" mode. (The script is extremely basic at the moment)

Contributor

sanjayankur31 commented Mar 7, 2016

@sanjayankur31: more out of interest: is this based on a vim postscript mode as our emacs mode is, or did you write it from scratch?

@jougs : I wrote it from scratch. I'm really new to vim scripting - not even sure if there is a "postscript" mode. (The script is extremely basic at the moment)

@weidel-p

This comment has been minimized.

Show comment
Hide comment
@weidel-p

weidel-p Mar 8, 2016

Contributor

Hi @sanjayankur31,

SLI files look really nice now in vim, but I have some minor remarks:

  1. The list of keywords need some cleanup. For example models and tests shouldn't be defined as keywords because they are actually not part of the syntax.
  2. The list of constants (M_INFO, M_ERROR, ..) is not complete (see http://www.nest-simulator.org/sli/setverbosity/)
  3. There are unresolved TODOs in the code, maybe it's worth to resolve them first.
Contributor

weidel-p commented Mar 8, 2016

Hi @sanjayankur31,

SLI files look really nice now in vim, but I have some minor remarks:

  1. The list of keywords need some cleanup. For example models and tests shouldn't be defined as keywords because they are actually not part of the syntax.
  2. The list of constants (M_INFO, M_ERROR, ..) is not complete (see http://www.nest-simulator.org/sli/setverbosity/)
  3. There are unresolved TODOs in the code, maybe it's worth to resolve them first.
@sanjayankur31

This comment has been minimized.

Show comment
Hide comment
@sanjayankur31

sanjayankur31 Mar 8, 2016

Contributor

Hey @weidel-p - I left the model names in there so that they're also highlighted - they're pretty much constants that Nest defines - what do you think? (I'll remove the tests, I thought I'd removed them already).

I'll work on the other bits and push new commits.

Contributor

sanjayankur31 commented Mar 8, 2016

Hey @weidel-p - I left the model names in there so that they're also highlighted - they're pretty much constants that Nest defines - what do you think? (I'll remove the tests, I thought I'd removed them already).

I'll work on the other bits and push new commits.

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser Mar 9, 2016

Contributor

@sanjayankur31 I think that keeping the models in is problematic. The set of models provided by NEST will change over time. If adding a neuron or synapse model will require changes to the vim style file, this will diverge. Furthermore, users are increasingly writing their own NEST modules that supply models, and those models would not be marked as keywords either. To handle this properly, vim would have to run NEST, import all modules loaded into a NEST script and dynamically update the keyword list.

Concerning the units, I would add at least Hz, and there may be a few more.

Contributor

heplesser commented Mar 9, 2016

@sanjayankur31 I think that keeping the models in is problematic. The set of models provided by NEST will change over time. If adding a neuron or synapse model will require changes to the vim style file, this will diverge. Furthermore, users are increasingly writing their own NEST modules that supply models, and those models would not be marked as keywords either. To handle this properly, vim would have to run NEST, import all modules loaded into a NEST script and dynamically update the keyword list.

Concerning the units, I would add at least Hz, and there may be a few more.

@sanjayankur31

This comment has been minimized.

Show comment
Hide comment
@sanjayankur31

sanjayankur31 Mar 9, 2016

Contributor

Ah, I don't think vim can do that in a syntax file - that's something that autocompletion plug-ins do, which will need to be developed separately. I'll look into it, though.

Contributor

sanjayankur31 commented Mar 9, 2016

Ah, I don't think vim can do that in a syntax file - that's something that autocompletion plug-ins do, which will need to be developed separately. I'll look into it, though.

@jougs

This comment has been minimized.

Show comment
Hide comment
Contributor

jougs commented Mar 9, 2016

sanjayankur31 added some commits Mar 9, 2016

@sanjayankur31

This comment has been minimized.

Show comment
Hide comment
@sanjayankur31

sanjayankur31 Apr 8, 2016

Contributor

Need to rebase this. Working on it.

Contributor

sanjayankur31 commented Apr 8, 2016

Need to rebase this. Working on it.

sanjayankur31 added some commits Apr 8, 2016

@tammoippen

This comment has been minimized.

Show comment
Hide comment
@tammoippen

tammoippen Apr 25, 2016

Contributor

@weidel-p Can you have another look into this PR, please? Thank you.

Contributor

tammoippen commented Apr 25, 2016

@weidel-p Can you have another look into this PR, please? Thank you.

extras/EditorSupport/vim/syntax/sli.vim
+syntax keyword sliTodo TODO XXX FIXME NOTE
+hi def link sliTodo Todo
+
+syn keyword sliKeyword abort abs abs_d abs_i ac_generator acos add addpath addtotrie allocations and append AppendTo Apply apropos arange area2 area array arrayload ArrayQ ArrayShape arraystore asin assert available backtrace_off backtrace_on begin bind break breakup callback call capacity case cd ceil cerr ChangeSubnet cin clear cleardict cleardictstack clic clock cloc clonedict close closeinput CompareFiles CompileMath Connect connruledict continue ConvergentConnect copy CopyFile CopyModel correlation_detector correlomatrix_detector correlospinmatrix_detector cos count countdictstack counttomark cout Create CreateRDV CreateRNG cst ctermid currentdict currentname CurrentSubnet cv1d convert 2-dimensional coordinates to 1-dim index cv2d cva cva_d cva_t cvd cvdict cvd_s cv_dv cvgidcollection cvi cvi_s cv_iv cvlit cvn cvo cvs cvs_f cvt_a cvx cycles CyclicValue DataConnect_a DataConnect DataConnect_i_D_s dc_generator debug debugoff debugon debug.sli def DeleteFile Device dexp dict DictQ dictstack Dimensions Directory dirname div DivergentConnect Dot1D Dot DoubleQ drand Drop dup2 dup edit elementstates empty end endl endusing environment eof eq_dv eq_iv eq erase Erfc Erf errordict eval EvaluateLiteralInfixes E exch exec ExecFunction ExecMath execstack executive exit exithook exp Export FileNames file FindConnections FindRoot FiniteQ First FixedPoint Flatten floor flush FoldList Fold forall forallindexed for fork FractionalPart frexp Function gabor_ Gammainc gamma_sup_generator gauss2d_ GaussDiskConv geq GetConnections getc GetDefaults get_d getenv GetGlobalChildren GetGlobalLeaves GetGlobalNodesInfo GetGlobalNodes GetGlobalRNG getinterval getline GetLocalChildren GetLocalLeaves GetLocalNodes GetMax GetMin GetNetwork GetOption GetOptions getPGRP getPID getPPID get gets GetStatus_dict GetStatus GetStatus_v GetSynapseStatus GetVpRNG GNUaddhistory GNUreadline good grep gt handleerror HasDifferentMemberQ helpdesk helpindex help iclear ieof ifail ifstream ignore igood in_avail index info info_ds initialize_module Inline insertelement insert inspect Install IntegerPart IntegerQ inv irand iround isatty is_mpi is_threaded is_threaded_with_openmp join joinpath JoinTo kernel keys kill known LambertW0 LambertWm1 LambertW Last LayoutArray LayoutNetwork ldexp length_a length length_d length_lp length_p length_s leq license LiteralQ ln load LocateFileNames log lookup loop ls lt MakeDirectory makehelp Map MapAt MapIndexed MapThread mark MathematicaToSliIndex mathexecutive MatrixQ Max max Mean MemberQ MemoryInfo memory_thisjob_bg memory_thisjob_darwin memory_thisjob MergeDictionary MergeLists message Min min mip_generator mkfifo mod modeldict modf Most MoveDirectory MoveFile ms2hms mul multimeter music_cont_in_proxy music_event_in_proxy music_event_out_proxy music_message_in_proxy namespace neg_d neg_i neg neq Nest nest_indirect NestList nest_serial Node noise_generator noop not npop NumberQ NumProcesses oclear oeof ofsopen ofstream ogood oldgetline ones operandstack Options OptionsDictionary or osstream ostrstream OuterProduct over page pageoutput parsestdin Partition Part path pclockspersec pclocks pcvs pgetrusage pick pipe Pi Plus poisson_generator_ps poisson_generator pop pow ppage ppd_sup_generator pp_pop_psc_delta pp_psc_delta pprint prepend print_error PrintNetwork print ProcessorName proxynode PseudoRecordingDevice pstack ptimes pulsepacket_generator put_d putinterval put pwd quit raiseagain raiseerror RandomArray RandomConvergentConnect RandomDivergentConnect Random RandomSubset Range Rank rdevdict ReadDouble ReadInt readline ReadList ReadModes readPGM Read ReadWord realtime RecordingDevice references regcomp regexdict regexec regex_find regex_find_r regex_find_rf regex_find_s regex_find_sf regex_replace RemoveDirectory removeguard repeatany repeat ReplaceOccurrences ReplacePart replace reserve ResetKernel ResetNetwork ResetOptions reset RestoreDictionary restoreestack RestoreOptions restoreostack restore Rest resume ResumeSimulation reverse rngdict rolld roll rollu rot round run SaveDictionary SaveOptions save ScanThread searchfile searchif searchifstream search seed Select SetAcceptableLatency SetDefaults Set SetDirectory SetFakeNumProcesses setguard setNONBLOCK SetNumRecProcesses SetOptions setpath setprecision SetStatus_dict SetStatus SetStatus_v SetSynapseStatus setverbosity SFWdumpparameters ShowDefaults ShowOptions ShowStatus shpawn shrink signaldict Sign Simulate sin sinusoidal_gamma_generator sinusoidal_poisson_generator size sleep_i sleep SLIFunctionWrapper SliToMathematicaIndex Sort spawn spike_detector spike_dilutor spike_generator spikes spin_detector Split spoon sqr sqrt stack StandardDeviation start statusdict step_current_generator StimulatingDevice stopped stop StringQ str subnet SubsetQ sub switchdefault switch symbol symbol_s synapsedict SyncProcesses sysexec system systemtime Table Take taskset taskset_thisjob TensorRank tic TimeCommunicationAlltoall TimeCommunicationAlltoall TimeCommunicationAlltoallv TimeCommunicationAlltoallv TimeCommunicationOffgrid TimeCommunication TimeCommunication TimeCommunicationv time Times tmpnam toc token_is token token_s ToLowercase ToMathematicaExpression topinfo_d Total ToUppercase Transpose trie trieinfo trim trunc typebind typeinfo type typestack undef unit_conversion UnitStep usertime using validate values Variance variant verbosity voltmeter volume_transmitter waitPID wait welcome which who whos writePGM xifstream xor zeros

This comment has been minimized.

@weidel-p

weidel-p Apr 25, 2016

Contributor

I think it doesn't change much, but do you want to keep the devices (like spike_detector in the list of keywords?

@weidel-p

weidel-p Apr 25, 2016

Contributor

I think it doesn't change much, but do you want to keep the devices (like spike_detector in the list of keywords?

This comment has been minimized.

@sanjayankur31

sanjayankur31 Apr 25, 2016

Contributor

I removed them after @heplesser 's remark that things from the API such as models may change in the future, and if we haven't a mechanism in place that will automatically update the list in sli.vim, we'd rather leave them out. I'm still looking at whether there's a way to autogenerate a list of keywords, but I think that requires a more complex plugin like YCM or something. I'm sure it can be done, I just haven't enough vim-fu to know how XD

@sanjayankur31

sanjayankur31 Apr 25, 2016

Contributor

I removed them after @heplesser 's remark that things from the API such as models may change in the future, and if we haven't a mechanism in place that will automatically update the list in sli.vim, we'd rather leave them out. I'm still looking at whether there's a way to autogenerate a list of keywords, but I think that requires a more complex plugin like YCM or something. I'm sure it can be done, I just haven't enough vim-fu to know how XD

This comment has been minimized.

@weidel-p

weidel-p Apr 26, 2016

Contributor

I totally agree with you. But there are still a lot of devices in the list of keywords. For example, there is the ac_generator, dc_generator, poisson_generator, spike_detector, spike_generator. voltmeter, volume_transmitter, multimeter, music_cont_in_proxy, ...

Please take a look again

@weidel-p

weidel-p Apr 26, 2016

Contributor

I totally agree with you. But there are still a lot of devices in the list of keywords. For example, there is the ac_generator, dc_generator, poisson_generator, spike_detector, spike_generator. voltmeter, volume_transmitter, multimeter, music_cont_in_proxy, ...

Please take a look again

This comment has been minimized.

@sanjayankur31

sanjayankur31 Apr 26, 2016

Contributor

I think I've removed all the devices and models now - hopefully.

@sanjayankur31

sanjayankur31 Apr 26, 2016

Contributor

I think I've removed all the devices and models now - hopefully.

extras/EditorSupport/vim/syntax/sli.vim
+syn match sliUnit '\spF'
+syn match sliUnit '\spA'
+syn match sliUnit '\sms'
+syn match sliUnit '\ss'

This comment has been minimized.

@weidel-p

weidel-p Apr 25, 2016

Contributor

In some cases this line causes a wrong highlighting. For example, the in command M_ERROR setverbosity the s is highlighted as unit. You could add a space after the declaration of the units to prevent that to happen.

After you change that, 👍 from me. Thanks for this work, I already used it several times!

@weidel-p

weidel-p Apr 25, 2016

Contributor

In some cases this line causes a wrong highlighting. For example, the in command M_ERROR setverbosity the s is highlighted as unit. You could add a space after the declaration of the units to prevent that to happen.

After you change that, 👍 from me. Thanks for this work, I already used it several times!

This comment has been minimized.

@sanjayankur31

sanjayankur31 Apr 25, 2016

Contributor

Looking into this - maybe I can add word boundaries or something to restrict the match.

@sanjayankur31

sanjayankur31 Apr 25, 2016

Contributor

Looking into this - maybe I can add word boundaries or something to restrict the match.

sanjayankur31 added some commits Apr 25, 2016

@sanjayankur31

This comment has been minimized.

Show comment
Hide comment
@sanjayankur31

sanjayankur31 Apr 25, 2016

Contributor

@weidel-p - this should work, please have a look when you have the time. Cheers.

Contributor

sanjayankur31 commented Apr 25, 2016

@weidel-p - this should work, please have a look when you have the time. Cheers.

@weidel-p

This comment has been minimized.

Show comment
Hide comment
@weidel-p

weidel-p Apr 26, 2016

Contributor

👍

Contributor

weidel-p commented Apr 26, 2016

👍

@tammoippen tammoippen merged commit 799ccc1 into nest:master Apr 26, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sanjayankur31 sanjayankur31 deleted the sanjayankur31:sli-vim branch Apr 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment