-
Notifications
You must be signed in to change notification settings - Fork 1
Adds internal documentation #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8d22927
contributing.md: inits
ufukty e5eccd0
contributing.md: removes redundant.
ufukty c4efb7f
contributing.md: aims to fix the github strips the image tags used fo…
ufukty f52b343
.vscodeignore: adds to exclude diagrams from the extension package.
ufukty ac1caa4
contributing.md: adds to notify project is closed for PRs and issues …
ufukty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| **/*.ts | ||
| **/eslint.config.mjs | ||
| **/tsconfig.json | ||
| diagrams/** | ||
| esbuild.mjs | ||
| media/** | ||
| node_modules/** | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Contributing | ||
|
|
||
| If you'd like to contribute, the best way right now is to open a bug report, suggestion, or question on [Dim GitHub Discussions](https://github.com/ufukty/dim/discussions). PRs and issues aren't being accepted from users at this stage. | ||
|
|
||
| ## Internals | ||
|
|
||
| Dim's code may not be straightforward to follow, as it employs several optimization techniques that scatter and intertwine logic across files. | ||
|
|
||
| ### Overview | ||
|
|
||
| The extension starts with the lifecycle controller. It is responsible for routing user events received from VS Code to the correct units. Units include the compiled user-config cache and individual editor decorators. Events include changes in the config, active and visible editors, and selections. | ||
|
|
||
| <picture> | ||
| <source srcset="./diagrams/structure@2x.png 2x"> | ||
| <img srcset="./diagrams/structure@2x.png 2x"> | ||
| </picture> | ||
|
|
||
| An editor decorator instance is responsible for a single `TextEditor` instance. It holds the UI state, including the per-document toggle and the ranges decorated at the previous iteration. | ||
|
|
||
| ### Compiled user-config cache | ||
|
|
||
| A Dim user-config may contain many RegExes, so compiled results are cached. The compiled config is sensitive to the scope of `TextEditor`. That's a shallow handle VS Code uses to represent a tab's session. Cache invalidation is triggered by the Extensions API event `onDidChangeConfiguration`. | ||
|
|
||
| <picture> | ||
| <source srcset="./diagrams/config-cache@2x.png 2x"> | ||
| <img srcset="./diagrams/config-cache@2x.png 2x"> | ||
| </picture> | ||
|
Comment on lines
+24
to
+27
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
|
|
||
| Cache keys may shift as VS Code returns different `TextEditor` instances for the same "tab" when the user switches between them. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ishikawa-beta | ||
| Recompile user-configuration | ||
| Raw user-configuration | ||
| File | ||
| Editor | ||
| Workspace | ||
| Scope | ||
| Top-level | ||
| Language-specific | ||
| Editor scope | ||
| Document URI | ||
| Language mode |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| block | ||
|
|
||
| columns 3 | ||
|
|
||
| space:2 ConfigReader | ||
| space:3 | ||
| space:2 ConfigCompiler | ||
| space:3 | ||
| EditorDecorator space ConfigCache | ||
| space:3 | ||
| LifecycleCtrl:3 | ||
| space:3 | ||
| ExtensionHost:3 | ||
|
|
||
| ConfigCompiler--"Scope"-->ConfigReader | ||
| ConfigCache--"Scope"-->ConfigCompiler | ||
| LifecycleCtrl--"Invalidate"-->ConfigCache | ||
| LifecycleCtrl--"Event, Command"-->EditorDecorator | ||
| ExtensionHost--"Events, Commands"-->LifecycleCtrl | ||
| EditorDecorator--"Scope"-->ConfigCache |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| fswatch diagrams/*.mmd | while read -r FILE; do | ||
| mmdc -i "$FILE" -o "${FILE/.mmd/@2x.png}" -s 2 -t neutral; | ||
| done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for future,
This "hack" works at the moment. But will cause duplicate placements once GitHub or VS Code enhance their
srcsetsupport.This combination seems redundant but each attachment works in either VS Code Markdown Preview or GitHub Markdown Preview.
GitHub seems to allow
srcsetattribute only on thesourcetags contained insidepictureelements, and VS Code only allows the attribute on theimgtags.Hardcoding the Markdown file for the diagram widths is worse, as they are very dynamic.
Both mediums ignore the other's solution.