Skip to content

Commit d2c8bac

Browse files
authored
Improve Display of Log Point Suggestions (#103)
- The icon for recommended/enabled operator log points is displayed at the very beginning of the line of the respective operator. This icon knows three states: - Log point recommended (gray outline) - Log point enabled (filled red) - Some log points enabled (filled gray; in case of multiple log points on one line, but not all of them enabled) - Try out: The log point indicator icon resembles a miniature version of Archie - Managing operator log points still works via the hover message of the actual operator
1 parent 62ccc0e commit d2c8bac

39 files changed

+1009
-444
lines changed

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
},
66
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
77
"typescript.tsc.autoDetect": "off",
8-
"typescript.tsdk": "node_modules/typescript/lib"
8+
"typescript.tsdk": "node_modules/typescript/lib",
9+
10+
"jest.disabledWorkspaceFolders": ["packages/extension-integrationtest"]
911
}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Before you submit a pull request, please discuss potential changes with the main
1111
To get started with development, follow these four steps:
1212

1313
1. Clone the repo and run `yarn` to install all dependencies.
14-
2. Open the repo in Visual Studio Code.
14+
2. Open `workspace.code-workspace` with Visual Studio Code.
1515
3. Run the "extension: Build and Watch" task, which will continuously (re-)build the extension.
1616
4. Run the "Testbench: NodeJS" launch configuration to open a new Visual Studio Code window, which:
1717
- loads the RxJS debugging extension in development mode, so you can use the debugger in the original Visual Studio Code window.

packages/extension-integrationtest/src/extension.test.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { Commands, executeCommand, TestCommands } from 'rxjs-debugging-for-vs-code/out/integrationTest';
1+
import {
2+
Commands,
3+
executeCommand,
4+
TestCommands,
5+
OperatorLogPoint,
6+
} from 'rxjs-debugging-for-vs-code/out/integrationTest';
27
import * as vscode from 'vscode';
38
import openAndShowTextDocument from './util/openAndShowTextDocument';
49
import waitForExtension from './util/waitForExtension';
@@ -9,12 +14,21 @@ describe('RxJS Debugging for vscode', () => {
914
await waitForExtension();
1015

1116
// Enable Operator Log Point for the first operator, take.
12-
await executeCommand(vscode.commands, Commands.EnableOperatorLogPoint, document.uri, new vscode.Position(5, 4), {
13-
fileName: document.uri.fsPath,
14-
line: 5,
15-
character: 25,
16-
operatorIndex: 0,
17-
});
17+
await executeCommand(
18+
vscode.commands,
19+
Commands.EnableOperatorLogPoint,
20+
new OperatorLogPoint(
21+
document.uri,
22+
new vscode.Position(5, 4),
23+
{
24+
fileName: document.uri.fsPath,
25+
line: 5,
26+
character: 25,
27+
operatorIndex: 0,
28+
},
29+
'take'
30+
)
31+
);
1832

1933
const debuggingDone = new Promise<void>((resolve) => {
2034
vscode.debug.onDidTerminateDebugSession(() => resolve());

packages/extension/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
"commands": [
2626
{
2727
"category": "RxJS",
28-
"command": "rxjs-debugging-for-vs-code.command.toggleOperatorLogPointRecommendations",
29-
"title": "%rxjs-debugging.command.toggleOperatorLogPointRecommendations%"
28+
"command": "rxjs-debugging-for-vs-code.command.toggleOperatorLogPointGutterIcon",
29+
"title": "%rxjs-debugging.command.toggleOperatorLogPointGutterIcon%"
3030
}
3131
],
3232
"configuration": {
3333
"title": "%rxjs-debugging.config.title%",
3434
"properties": {
35-
"debug.rxjs.showOperatorLogPointRecommendations": {
36-
"description": "%rxjs-debugging.config.showOperatorLogPointRecommendations%",
35+
"debug.rxjs.recommendOperatorLogPointsWithAnIcon": {
36+
"description": "%rxjs-debugging.config.recommendOperatorLogPointsWithAnIcon%",
3737
"type": "boolean",
3838
"default": true
3939
},
@@ -97,9 +97,9 @@
9797
"@types/webpack": "5.28.0",
9898
"@types/ws": "8.2.0",
9999
"jest": "27.3.1",
100+
"rollup": "2.59.0",
100101
"rollup-plugin-copy": "3.4.0",
101102
"rollup-plugin-terser": "7.0.2",
102-
"rollup": "2.59.0",
103103
"ts-jest": "27.0.7",
104104
"tslib": "2.3.1",
105105
"typescript": "4.4.4",
@@ -111,6 +111,7 @@
111111
"@rxjs-debugging/telemetry": "0.0.0",
112112
"inversify": "5.1.1",
113113
"reflect-metadata": "0.1.13",
114+
"spicery": "2.1.2",
114115
"typescript": "4.4.4",
115116
"vscode-nls": "5.0.0",
116117
"ws": "8.2.3"

packages/extension/package.nls.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"rxjs-debugging.config.title": "RxJS Debugging",
33
"rxjs-debugging.config.hideLiveLogWhenStoppingDebugger": "When enabled, live log values are hidden automatically after stopping the debugger.",
4-
"rxjs-debugging.config.showOperatorLogPointRecommendations": "When enabled, recommended operator log points will be shown automatically. Hint: You can toggle this setting using the related command in the command palette as well.",
4+
"rxjs-debugging.config.recommendOperatorLogPointsWithAnIcon": "When enabled, recommended operator log points will be indicated using an icon at the beginning of the line. Hint: You can toggle this setting using the related command in the command palette as well.",
55
"rxjs-debugging.config.logLevel": "Internal log level for the extension. (reload required)",
6-
"rxjs-debugging.command.toggleOperatorLogPointRecommendations": "Toggle Display of Operator Log Point Recommendations"
6+
7+
"rxjs-debugging.command.toggleOperatorLogPointGutterIcon": "Toggle gutter icon for recommended operator log points"
78
}
Lines changed: 57 additions & 0 deletions
Loading
Lines changed: 57 additions & 0 deletions
Loading
Lines changed: 57 additions & 0 deletions
Loading

packages/extension/src/__mocks__/vscode.ts

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,31 @@ export class Disposable {
6969

7070
export class Uri implements UriType {
7171
static parse(value: string, strict?: boolean): Uri {
72-
return new Uri('', '', '', '', '');
72+
return new Uri('', '', value, '', '');
7373
}
7474

7575
static file(path: string): Uri {
76-
return new Uri('', '', '', '', '');
76+
return new Uri('', '', path, '', '');
7777
}
7878

7979
static joinPath(base: Uri, ...pathSegments: string[]): Uri {
8080
return new Uri('', '', '', '', '');
8181
}
8282

83-
static from(components: {
83+
static from({
84+
scheme,
85+
authority = '',
86+
path = '',
87+
query = '',
88+
fragment = '',
89+
}: {
8490
scheme: string;
8591
authority?: string;
8692
path?: string;
8793
query?: string;
8894
fragment?: string;
8995
}): Uri {
90-
return new Uri('', '', '', '', '');
96+
return new Uri(scheme, authority, path, query, fragment);
9197
}
9298

9399
private constructor(
@@ -100,15 +106,39 @@ export class Uri implements UriType {
100106

101107
readonly fsPath: string = '';
102108

103-
with(change: { scheme?: string; authority?: string; path?: string; query?: string; fragment?: string }): Uri {
104-
return this;
109+
with({
110+
scheme,
111+
authority,
112+
path,
113+
query,
114+
fragment,
115+
}: {
116+
scheme?: string;
117+
authority?: string;
118+
path?: string;
119+
query?: string;
120+
fragment?: string;
121+
}): Uri {
122+
return new Uri(
123+
scheme || this.scheme,
124+
authority || this.authority,
125+
path || this.path,
126+
query || this.query,
127+
fragment || this.fragment
128+
);
105129
}
106130

107131
toString(skipEncoding?: boolean): string {
108132
return '';
109133
}
110134

111135
toJSON(): any {
112-
return {};
136+
return {
137+
scheme: this.scheme,
138+
authority: this.authority,
139+
path: this.path,
140+
query: this.query,
141+
fragment: this.fragment,
142+
};
113143
}
114144
}
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { IOperatorIdentifier } from '@rxjs-debugging/telemetry/out/operatorIdentifier';
2-
import { Position, Uri } from 'vscode';
1+
import OperatorLogPoint from '../operatorLogPoint';
32

43
export const enum Commands {
54
EnableOperatorLogPoint = 'rxjs-debugging-for-vs-code.command.enableOperatorLogPoint',
65
DisableOperatorLogPoint = 'rxjs-debugging-for-vs-code.command.disableOperatorLogPoint',
7-
ToggleOperatorLogPointRecommendations = 'rxjs-debugging-for-vs-code.command.toggleOperatorLogPointRecommendations',
6+
ToggleOperatorLogPointGutterIcon = 'rxjs-debugging-for-vs-code.command.toggleOperatorLogPointGutterIcon',
87
}
98

109
export interface ICommandTypes {
11-
[Commands.EnableOperatorLogPoint]: (uri: Uri, position: Position, operatorIdentifier: IOperatorIdentifier) => void;
12-
[Commands.DisableOperatorLogPoint]: (uri: Uri, position: Position, operatorIdentifier: IOperatorIdentifier) => void;
13-
[Commands.ToggleOperatorLogPointRecommendations]: () => void;
10+
[Commands.EnableOperatorLogPoint]: (operatorLogPoint: OperatorLogPoint | string) => void;
11+
[Commands.DisableOperatorLogPoint]: (operatorLogPoint: OperatorLogPoint | string) => void;
12+
[Commands.ToggleOperatorLogPointGutterIcon]: () => void;
1413
}

packages/extension/src/commands/getMarkdownCommandWithArgs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { ICommandTypes } from './commands';
22

33
export default function getMarkdownCommandWithArgs<K extends keyof ICommandTypes>(
44
key: K,
5-
args: Parameters<ICommandTypes[K]>
5+
args: Parameters<ICommandTypes[K]>,
6+
serialize: (args: Parameters<ICommandTypes[K]>) => [string] = (args) => [JSON.stringify(args)]
67
): string {
7-
return `command:${key}?${encodeURIComponent(JSON.stringify(args))}`;
8+
return `command:${key}?${encodeURIComponent(JSON.stringify(serialize(args)))}`;
89
}

0 commit comments

Comments
 (0)