Skip to content

Commit

Permalink
feat: add support for documentation from septic source code (#233)
Browse files Browse the repository at this point in the history
* Add documentation from SEPTIC source code script

* Update loading of meta info

* Update structure of calc documentation

* Update object meta info

* Add signature help for calcs

* Update formating of parameters

* Update parsing of arity

* Add diagnostics for calcs

* Use consistent naming for algs

* Update flag for optional params

* Add automatic parsing of object doucmentation

* Update formatting of calcs

* Update output path object doc

* Add tests for calc diagnostics

* Refactor alg diagnositcs

* Add hover for object documentation

* Add completion for object attr

* Add unittest for completion

* Refactor diagnostics

* Add diagnostics for attributes based on docs

* Add unittests for hover

* Add unittests for signature help

* Refactor completion provider to be leaner

* Add ignore for test coverage on providers

* Improve test coverage diagnostics

* Improve test coverage reference provider

* Refactor formatter

* Add copyright

* Add copyright notice

* Add validation for max length alg

* Remove unused code

* Improve test coverage foldingrange

* Add ignore statements for coverage test

* Add tests for renaming

* Update format fixtures

* Fix bug with line ending

* Ignore empty references

* Add parent object for object doc

* Fix error in yaml

* Add levels for obj doc nodes

* Restructure metainfo file

* Add object hierarchy in meta info

* Add diagnotics for object structure

* Update parsing of object documentation

* Add README for updating doc

* Update parsing of doxygen to new format

* Add completion of public properties in algs

* Add diagnostics for public properties

* Add check for invalid char in string

* Make completion of calcs searchable based on description

* Update diagnostic severity levels

* Update scripts to current doc spec

* Update parsing of doc to latest spec

* WIP

* Update calc documentation parsing

* Update scripts for parsing object doc

* Fix parsing of parent objects

* Update code to newest doc format

* Add latest doc

* Remove unused import

* Update documentation

* Support attributes with postfix

* Update README

* Update supported objects in calc

* Fix bug with completion in empty doc

* Support signature help for non alt calcs

* Add quality and value to calc doc

* Update formatting of attrs

* Fix search functionality in calcs

* Update readme

* Add tests for signaturehelp

* Update scripts

* Fix updating of object levels scg

* Update documentation

* Reuse function

* Fix formatting of datatype in error msg

* Update readme

* Update default level for unknown obj types

* Update object doc formatting

* Update documentation

* Update documentation

* Update snippet to avoid name collision

* Add public properties to object doc

* Add public propety to attribute doc

* Support new bit datatype for attributes

* Update documentation

* Update documentation

* Update documentation
  • Loading branch information
vetlek authored Sep 28, 2023
1 parent 2151d6c commit fc913bd
Show file tree
Hide file tree
Showing 65 changed files with 15,429 additions and 1,212 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ out
node_modules
.vscode-test/
*.vsix
.env
*.env
.venv
.cpp
__pycache__
.nyc_output
coverage/
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Update Documentation",
"type": "python",
"request": "launch",
"program": "${workspaceRoot}/scripts/main.py",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Attach to server",
"port": 6009,
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@
- GoToDeclaration: Goes to the declaration of the connected SopcXvr when referenced (e.g. in calcs, Xvr etc.)
- Find References: Finds all references to a (Sopc)Xvr (e.g. in calcs, object declaration, XvrPlot etc.)
- Ignore Diagnostics for specified paths.
- Documentation: Built in documentation of objects/attributes and calcs based on source code.
- SignatureHelp: Signature help for calcs

## Instructions

If you don't know what the SEPTIC file format is, then you don't need this extension.

Adding the SEPTIC extension to VS Code allows you to do the following when loading a SEPTIC .cnfg file:

- Auto-complete (Sopc)Xvr names and Calcs.
- Auto-complete (Sopc)Xvr names/properties, object attributes and calcs.
- Diagnose certain fault modes (missing parenthesis in calcs, mistyped Calc or Xvr names etc.)
- Auto-complete commonly used segments of code, called snippets
- Type e.g. 'sopc' (uncapitalized letters only), and you should see a number of sopcxvr snippet options. Choose the one you want with `arrow up`/`arrow down` and press `Tab` to create a complete sopcxvr section.
Expand All @@ -52,6 +54,12 @@ Adding the SEPTIC extension to VS Code allows you to do the following when loadi

- Formatting of cnfg files can be enabled by setting `septic.formatting.enabled = True` in the settings. Comments `// or /* */` and jinja-comments `{# #}` are not formatted. Everything between the jinja expressions `{% for w %}` ... `{% endfor %}` and `{% if %}` ... `{% endif %}` are not formatted. To avoid formatting certain sections of the file the flags `{# format:off #}` and `{# format:on #}` can be used to turn off and on again formatting (Tip: snippets available by writing `formaton/off`).

- Documentation of objects and calcs are available by hovering over the object/calc definition. Hovering on object definition will provide an overview of the object and related attributes. For more information about a certain attribute (datatype, description etc.), hover over the definition of the attribute. Hovering over a calc will provide information about parameters, return values, quality etc.

- SignatureHelp is provided when writing calcs inside CalcPvr.Alg. The signature is shown with the active parameter highlighted together with the documentation of the active parameter. SignatureHelp can be manually activated by pressing `Ctrl + Shift + Space`.

- Search functionality for calcs are builtin into the completion. To start searching, start typing the search word into the CalcPvr.Alg field and all calcs that has the relevant search word in the documentation is included in the filtered results. Pressing `Ctrl + Space` starts the completion without a starting phrase and can be used to browse all available calcs and variables inside a CalcPvr.Alg.

The extension supports SEPTIC projects that uses the SEPTIC Config Generator (SCG). The SCG-config file for the project is loaded and the relevant `.cnfg` files (required to be in the templates folder) listed in the layout section are loaded into a common context that shares references etc.

## Feedback and contributions
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
".tsx"
],
"exclude": [
"coverage/",
"**/*.test.ts",
"**/test/util/*",
"client/*",
Expand All @@ -125,17 +126,20 @@
"server/src/documentProvider.ts",
"server/src/settings.ts",
"server/src/protocol.ts",
".vscode-test/*"
".vscode-test/*",
"**/index.ts"
],
"reporter": [
"html"
],
"require": [
"ts-node/register"
"ts-node/register",
"source-map-support/register"
],
"all": true,
"cache": false,
"sourceMap": true,
"instrument": true,
"all": true
"instrument": true
},
"scripts": {
"vscode:prepublish": "npm run compile",
Expand All @@ -148,7 +152,7 @@
"postinstall": "cd client && npm install && cd ../server && npm install && cd ..",
"e2e-test": "npm run compile && node ./client/out/test/runTest",
"test": "mocha --require ts-node/register server/src/test/**/*.test.ts ",
"test_with_coverage": "nyc mocha --require ts-node/register --require source-map-support/register server/src/test/**/*.test.ts "
"test_with_coverage": "npm run compile && nyc mocha --require ts-node/register --require source-map-support/register --recursive server/src/test/**/*.test.ts "
},
"devDependencies": {
"@types/chai": "4.3.6",
Expand Down
Loading

0 comments on commit fc913bd

Please sign in to comment.