Skip to content

Sebagabones/cicode-mode.el

Repository files navigation

Cicode-mode is a major mode for Emacs.

I wrote this as my current job involves writing Cicode, and the only editor (at the time) that had some support for it (aside from the, er, terrible built in editor that came with Citect/PlantSCADA) was Notepad++. Although, there now exists a vscode extension - which may or may not have inspired me to add some additional improvements to cicode-mode :P.

As an Emacs user, this would not do, and so I quickly made cicode-mode. It is not particularly good, and any contributions are welcome. Do note that this is my first attempt at making a mode for Emacs, and I do not think that I am very good at elisp.

Installation

Using use-package:

(use-package cicode-mode
  :straight (cicode-mode :type git :host github :repo "Sebagabones/cicode-mode.el")
  :ensure t  )

You will probably want to edit/set the variable cicode-mode-max-docstring-width (and possibly cicode-mode-max-docstring-length), as these dictate the length of the description in the completion popup (some of the explanations are very large).

Example:

doc/example.png

Features

  • Indentation
  • Syntax Highlighting
    • This includes the lesser known parts of Cicode, including support for variable/function scope.
  • There is now completion using capf! I have not tested it with company, but corfu does work (and there are even docs with corfu-popupinfo).
  • Eldoc support for documentation - including syntax highlighted examples!

An example of inbuilt documentation (I am using eldoc-box): doc/example2.png

Roadmap:

  • Add in additional completions for things like FUNCTION ect.
  • I would quite like the ability to parse in .ci files, producing completions/gotos for non-builtin functions.
    • This may be in the form of treesitter, or I may use simple regex parsing - feel free to contribute ideas/thoughts :)

Contributing:

Contributions are very welcome! Something that is pretty easy to work on fixes for is if you find any odd completions/docstrings. These were generated by parsing the HTML docs, but sadly the docs were not consistent, so there are bound to be errors. Feel free to adjust the JSON file in src/builtins.json if you find any that are incorrect. I plan to setup a GH action that automatically builds the cicode-mode-builtins.el file from the JSON file, but for now you can run convert-json-to-elisp-string.py to do it.

About

Emacs major mode for the Cicode programming language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •