Skip to content

Commit

Permalink
Merge pull request #113 from moalamri/dev/0.2.4
Browse files Browse the repository at this point in the history
Dev/0.2.4
  • Loading branch information
moalamri authored Apr 25, 2023
2 parents c9cfe59 + e3bb9a8 commit 07d8b2b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Inline fold",
"description": "A custom decorator that \"fold\" matching content in single line",
"icon": "res/icon.png",
"version": "0.2.3",
"version": "0.2.4",
"publisher": "moalamri",
"homepage": "https://github.com/moalamri/vscode-inline-fold",
"bugs": "https://github.com/moalamri/vscode-inline-fold/issues",
Expand Down Expand Up @@ -105,7 +105,7 @@
]
},
"inlineFold.regexGroup": {
"type": "string",
"type": ["string", "number"],
"scope": "language-overridable",
"description": "Regex capture group number for content that will be folded",
"default": "6",
Expand Down
2 changes: 1 addition & 1 deletion src/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Decorator {
CurrentEditor: TextEditor;
ParsedRegexString: string;
SupportedLanguages: string[] = [];
Offset: number = 30;
Offset: number = 50;
StartLine: number = 0;
EndLine: number = 0;

Expand Down
8 changes: 2 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export function activate(context: ExtensionContext) {
});

const changeSelection = window.onDidChangeTextEditorSelection((e) => {
// event.kind is undefined when the selection change happens from tab switch or undo/redo
// good to limit the number of times the decoration is updated, so no need
// to fire the event if it's undefined
if (!e.kind) return;
elimit.Lead();
});

Expand All @@ -48,8 +44,8 @@ export function activate(context: ExtensionContext) {
// e.reason = 1 when undo
// e.reason = 2 when redo
// this event gets fired when any change happens to any text document in the workspace
// so we will limit it to only update the decoration when the change is caused by undo/redo
// also because `changeSelection` gets fired as well while typing.
// so to limit the decoration it will fire when the change is caused by undo/redo
// since `changeSelection` gets fired as well while typing or moving lines.
if (e.reason !== 1 && e.reason !== 2) return;
elimit.Trail();
});
Expand Down

0 comments on commit 07d8b2b

Please sign in to comment.