Skip to content

Commit 7dd545d

Browse files
committed
add hover provider for user-defined doc
and refactor Signed-off-by: Qingpeng Li <qingpeng9802@gmail.com>
1 parent d808fee commit 7dd545d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3546
-1208
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
"anonymous": "always", "named": "never", "asyncArrow": "always"
164164
} ],
165165

166-
"@typescript-eslint/no-duplicate-imports": "warn",
166+
// "@typescript-eslint/no-duplicate-imports": "warn", // deprecated to import/
167167
"@typescript-eslint/no-extra-semi": "warn",
168168
"@typescript-eslint/no-loop-func": "warn",
169169
"@typescript-eslint/no-loss-of-precision": "warn",

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# Change Log
2+
## [1.2.5] - 2023-07-25
3+
### Added
4+
- add hover provider for user-defined doc
5+
6+
### Changed
7+
- refactor the folder layers
28

39
## [1.2.4] - 2023-06-27
410
### Added

CONTRIBUTING.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ Let us first take a brief look at the design of this project.
77

88
![layers](./images/layers.png)
99

10-
The image above shows the layers of the source code. `entry` initializes the extension and applies the vscode workspace configuration to the extension. `provider_interface` registers the providers in vscode. `builders` prepares the data structures from the raw text string/processed semantic information for vscode language features. `collect_info` collects the semantic information from the raw text string. `common` includes some constants and algorithms. `doc` is the interface for getting documentation.
10+
The image above shows the layers of the source code. `entry` initializes the extension and applies the vscode workspace configuration to the extension. `provider_interface` registers the providers in vscode. `builders` prepare the data structures from the raw text string/processed semantic information for vscode language features. `collect_info` collects the semantic information from the raw text string. `common` includes some constants and algorithms. `doc` is the interface for getting documentation.
11+
12+
If you are interested in a more detailed dependency graph, you can find the dependency graph in [`./images/dependency_graph.svg`](./images/dependency_graph.svg). Also, you can generate the dependency graph by running
13+
> You may need to run `sudo apt install graphviz` first
14+
```shell
15+
npx depcruise src --no-config --include-only "^src" --output-type dot | dot -T svg > ./images/dependency_graph.svg
16+
```
17+
1118

1219
## Data Flow
1320

@@ -25,24 +32,35 @@ Also, the dirty listener will set the dirty flag to true in `structuredInfo` whe
2532

2633
### Core Functionality Part
2734
This part is below the dashed line in the Data Flow diagram. The core functionality is in this part. First, if you are not familiar with vscode extension, please just check [patterns-and-principles](https://vscode-docs.readthedocs.io/en/stable/extensions/patterns-and-principles/) and [programmatic-language-features](https://code.visualstudio.com/api/language-extensions/programmatic-language-features).
28-
When vscode requests language information from a provider, the provider will call `produceResultByDoc` to get updated semantic information. Then, the provider will return the information to vscode. If you are interested in how the provider works, you can check the samples in [vscode-extension-samples samples](https://github.com/microsoft/vscode-extension-samples#samples) which used API `languages.`
29-
30-
## Version Control
31-
The version number is in the format MAJOR.MINOR.PATCH. We do not comply with the *Semantic Versioning* strictly. We save x.x.0 for the *alpha version* and x.x.1 for the *beta version*.
35+
When vscode requests language information from a provider, the provider will call `updateResultByDoc` to get updated semantic information. Then, the provider will return the information to vscode. If you are interested in how the provider works, you can check the samples in [vscode-extension-samples samples](https://github.com/microsoft/vscode-extension-samples#samples) which used API `languages.`
3236

3337
## Compile & Package
3438

3539
### Setup
3640

3741
Run `npm install`
3842

43+
### Development
44+
- How to add a vscode provider?
45+
1. add a pair (k, v) in `TraceableDisposables.disposables`
46+
2. add a pair (k, v) in `TraceableDisposables.cfgMapDisposable`
47+
3. add a case in `TraceableDisposables.registerProviderByName`
48+
4. add a config (k, v) in `WorkspaceConfig.config`
49+
5. add a config in `contributes.configuration.properties` in `package.json`
50+
51+
- How to change the parsing process?
52+
The parsing process is in `collect_from_text`, and the symbol information are stored in `Map{name: SymbolInfo}`
53+
54+
- How to change the vscode-formated language information?
55+
`builders` prepare the vscode-formated language information. See `export{}` to understand what information the builder is building.
56+
3957
### Compile
4058

41-
Run `npm run esbuildc` for compile once;
59+
Run `npm run esbuildc` for compiling once;
4260
Run `npm run esbuildw` for watch mode;
4361
Run `npm run esbuildp` for production.
4462

45-
> Please remember to execute `npm run tscc` for TypeScript type checking separately.
63+
> Please remember to run `npm run tscc` for TypeScript type checking separately.
4664
4765
For more commands, check them in `"scripts"` in `package.json`.
4866

@@ -55,6 +73,9 @@ Note that we are trying to use `esbuild` as the bundler since it is faster than
5573
"parcelp": "parcel build ./src/web/extension.ts --dist-dir ./dist/web --no-source-maps",
5674
```
5775

76+
### Debug
77+
See [debugging-the-extension](https://code.visualstudio.com/api/get-started/your-first-extension#debugging-the-extension). Note that `"preLaunchTask": "npm: esbuildw"` in `launch.json` is disabled in this project so you need to run `npm run esbuildc` (or just enable `"preLaunchTask"`) before launching the debugger.
78+
5879
### Linting
5980
Run `npm run lint` for linting.
6081
Most errors and warnings can be fixed automatically by running `npm run lint -- --fix`.
@@ -70,6 +91,9 @@ Then, you will get a `common-lisp-x.x.x.vsix` in your `./` .
7091

7192
If you would like to use the packaged `.vsix` extension, you can load the `.vsix` extension to vscode by referring to [extension-marketplace install-from-a-vsix](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix).
7293

94+
## Version Control
95+
The version number is in the format MAJOR.MINOR.PATCH. We do not comply with the *Semantic Versioning* strictly. We save x.x.0 for the *alpha version* and x.x.1 for the *beta version*.
96+
7397
## Code Style
7498
We are trying to write dumb code. TypeScript has many fancy syntax features, however, we would not like to use them too much. We are trying to maintain the best readability while utilizing some useful syntax features.
7599

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ draft proposed American National Standard for Information Systems—Programming
8686
[Scheme.tmLanguage](https://github.com/egrachev/sublime-scheme/blob/master/Scheme.tmLanguage),
8787
[Lisp.tmLanguage](https://github.com/bradrobertson/sublime-packages/blob/master/Lisp/Lisp.tmLanguage),
8888
[regex101](https://regex101.com/),
89-
[structure101](https://structure101.com/)
89+
OSS license from [structure101](https://structure101.com/)
9090

9191
### Image Credits
9292
The `icon.png` is from [Common-Lisp.net](https://common-lisp.net/) and resized.

images/data_flow.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)