Skip to content

Commit f95bb4c

Browse files
author
Diego Fernandez
committed
Last review
1 parent fa6af05 commit f95bb4c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

plugInREADME.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## Introduction
44

5-
This document outlines potential approaches to extend the functionality of the `trlc-vscode-extension` to address specific requirements, such as those of BMW. It explores 2 options: 1) to create a BMW-specific fork of the extension or 2) To implement a plugin system through a second vscode extenstion. On both approaches tha changes to the existing architecture are adressed to enable the functionalities. In the second option the modifying the core extension was minimized as much as possible by sugesting an elegant solution for it: exposing its data through its own `API`.
5+
This document outlines potential approaches to extend the functionality of the `trlc-vscode-extension` to address specific requirements, such as those of BMW. It explores 2 options: 1) to create a BMW-specific fork of the extension or 2) To implement a plugin system through a second vscode extenstion. On both approaches the changes to the existing architecture are adressed to enable the functionalities. In the second option the modifying the core extension was minimized as much as possible by sugesting an elegant solution for it: *"exposing its data through its own `API`"*.
66

77
## Context
88

9-
The `trlc-vscode-extension` uses a so-called “Language Server Protocol” (LSP) to comply with the TRLC programming language. With this server, the extension provides features like syntax checking for `.rsl` and `.trlc` files directly in VSCode. The heart of the VSCode extension uses an open-source tool called: **Pygls**.
9+
The `trlc-vscode-extension` uses a so-called “Language Server Protocol” (LSP) to comply with the TRLC programming language. With this server, the extension provides features like syntax checking for `.rsl` and `.trlc` files directly in VSCode. The heart of the VSCode extension uses an open-source tool called: [**Pygls**](https://github.com/openlawlibrary/pygls).
1010

11-
The Language Server Protocol (LSP) is a standard created by Microsoft to simplify adding language features like autocompletion, syntax checking, and error diagnostics to code editors. It separates the editor's user interface (client) from language-specific logic (server), enabling reusability of the same server across multiple tools.
11+
The Language Server Protocol (LSP) is a standard created by Microsoft to simplify adding language features like autocompletion, syntax checking, and error diagnostics to any code editor. It separates the editor's user interface (client) from language-specific logic (server), enabling reusability of the same server across multiple editors.
1212

1313
**Pygls** implements the TRLC rules within its own created `TrlcLanguageServer` in a easy way by providing built-in classes and methods to create the specific LSP servers in Python.
1414

@@ -18,7 +18,7 @@ The extension follows a client-server model, utilizing the LSP to separate the e
1818

1919
The client is implemented [here](https://github.com/bmw-software-engineering/trlc-vscode-extension/blob/main/client/src/extension.ts). It handles the communication between the VSCode editor and the Python-based server.
2020

21-
The server is implemented [here](https://github.com/bmw-software-engineering/trlc-vscode-extension/blob/main/server/__main__.py). It performs all the heavy lifting for parsing and analyzing `.rsl` and `.trlc` files aided from the back-end `TRLC` software with its modulesx.
21+
The server is implemented [here](https://github.com/bmw-software-engineering/trlc-vscode-extension/blob/main/server/__main__.py). It performs all the heavy lifting for parsing and analyzing `.rsl` and `.trlc` files aided from the back-end `TRLC` software with its modules.
2222

2323
The LSP (Language Server Protocol) operates on a client-server mode:
2424

@@ -43,7 +43,7 @@ _Disclaimer_: The changes represented in PR 31 try to point into the most proabl
4343

4444
Branch with the concept: [PR #32](https://github.com/bmw-software-engineering/trlc-vscode-extension/pull/32)
4545

46-
Implementing a plugin system allows isolating almost completely the original `vscode-trlc-extension`. BMW-specific logic and needs would be packaged into a new `vscode-trlc-bmw-expansion-extension` that the original open-source extension dynamically feeds through a yet-to-be implemented API. This avoids modifying too much the core extension but requires compatibility management. And depending on the complexity of the future features could require its own LSP. At the moment of writing this document and the discussed bmw specific needs, a "client-only" second extension seems to be enough to fulfill the task. Nonetheless, a second LSP would provide advanced language processing posibilities.
46+
Implementing a plugin system allows isolating almost completely the original `vscode-trlc-extension`. BMW-specific logic and needs would be packaged into a new `vscode-trlc-bmw-expansion-extension` that the original open-source extension dynamically feeds through a yet-to-be implemented API. This avoids modifying too much the core extension but requires compatibility management. And depending on the complexity of the future features could require its own LSP. At the moment of writing this document and the discussed bmw specific needs, a "*client-only*" second extension seems to be enough to fulfill the task. Nonetheless, a second LSP would provide advanced language processing posibilities.
4747

4848
To enable communication with the current extension, the client needs to expose an API. Currently, this is **not the case**, but a proper API could be built in the current `extension.ts`. Microsoft Examples: [VSCode API](https://code.visualstudio.com/api/references/vscode-api#extensions:~:text=open%20was%20successful.-,extensions,-Namespace%20for%20dealing)
4949

@@ -85,7 +85,7 @@ In the original extension, edit `client/src/extension.ts` to expose a function l
8585

8686
In the new extension (`extension2.ts`), use the exposed API by accessing `trlc-vscode-extension` via `vscode.extensions.getExtension`, calling `getHoverDetails` to fetch hover data, and enhancing functionality, such as formatting text using `TextEditorDecorationType` [see here](https://code.visualstudio.com/api/references/vscode-api#window.createTextEditorDecorationType:~:text=createTextEditorDecorationType(options%3A%20DecorationRenderOptions)%3A%20TextEditorDecorationType) or making API requests to external services like CodeBeamer.
8787

88-
Also, inside `extension2.ts`, enable sanity checks with a proposed tool called `sanity_checks.py`. This Python script, analogous to `server.py`, can use relevant modules of TRLC’s backend. **This can be tricky** and/or very time-consuming and must be planned correctly. If any sanity errors were found, the UI changes can be handled. The Python script could be run with Node.js's `child_process` module and pass the workspace to parse as an argument.
88+
Also, inside `extension2.ts`, enable sanity checks with a proposed tool called `sanity_checks.py`. This Python script, analog to `server.py`, can use relevant modules of TRLC’s backend. **This can be tricky** and/or very time-consuming and must be planned correctly. If any sanity errors were found, the UI changes can be handled. The Python script could be run with Node.js's `child_process` module and pass the workspace to parse as an argument.
8989

9090
Later on in the CI the `sanity_checks.py` can be run as well.
9191

@@ -145,10 +145,9 @@ export function activate(context: vscode.ExtensionContext) {
145145

146146
The previous suggestion is assuming a simple command identifier `fetchAndRenderHtml` that could be programmatically triggered. But the proper event listener must yet be at best defined, like hover over CB id or clicking it.
147147

148-
149148
#### 2. Pretty-printing TRLC files
150149

151-
To print `*.trlc` files in commonmark there is an open source [tool](https://github.com/markdown-it/markdown-it) called: `markdown-it` . Which is implemented in `Node.js` and can be integrated into the client. It can interpret text formatted as common mark, like: \*\*Some string in trlc\*\* could be rendered to **Some string in trlc**. This, of course, implies first to adjust/edit the desired strings before giving those to `markdown-it`
150+
To print `*.trlc` files in commonmark there is an open source tool called: [`markdown-it`](https://github.com/markdown-it/markdown-it). Which is implemented in `Node.js` and therefore can be integrated into the client inside VSCode. It can interpret text formatted as common mark, like: \*\*Some string in trlc\*\* could be rendered to **Some string in trlc**. This, of course, implies **first** to adjust/edit the desired strings before giving those to `markdown-it`.
152151

153152
View demo [here](https://markdown-it.github.io/)
154153

0 commit comments

Comments
 (0)