Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitede2a3d

Browse files
committed
Implement observer-based debug item value display.
1 parent324949c commitede2a3d

File tree

14 files changed

+448
-296
lines changed

14 files changed

+448
-296
lines changed

‎.vscode/settings.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"eslint.useFlatConfig":true,
44
"[typescript]": {
55
"editor.codeActionsOnSave": {
6-
"source.fixAll":"explicit",
6+
"source.removeUnusedImports":"always",
7+
"source.fixAll.eslint":"always"
78
}
89
},
910
}

‎eslint.config.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,29 @@ module.exports = [
1010
'parser':require('@typescript-eslint/parser'),
1111
},
1212
'plugins':{
13-
'@typescript-eslint':require('@typescript-eslint/eslint-plugin'),
13+
'@stylistic':require('@stylistic/eslint-plugin'),
14+
'@typescript':require('@typescript-eslint/eslint-plugin'),
1415
},
1516
'rules':{
16-
'semi':'error',
1717
'no-throw-literal':'error',
18+
'semi':'error',
19+
'no-extra-semi':'error',
20+
'eqeqeq':'error',
21+
'prefer-const':'warn',
1822
'curly':'warn',
19-
'eqeqeq':'warn',
20-
'@typescript-eslint/naming-convention':[
23+
'@typescript/naming-convention':[
2124
'warn',
2225
{
2326
'selector':'import',
2427
'format':['camelCase','PascalCase']
2528
}
2629
],
30+
'@stylistic/indent':['warn',4],
31+
'@stylistic/quotes':['warn','single'],
32+
'@stylistic/brace-style':['warn','1tbs'],
33+
'@stylistic/curly-newline':['warn',{'minElements':1,'consistent':true}],
34+
'@stylistic/keyword-spacing':'warn',
35+
'@stylistic/space-before-blocks':'warn',
2736
},
2837
}
2938
];

‎package.json‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,12 @@
214214
"@types/vscode":"^1.94",
215215
"@typescript-eslint/eslint-plugin":"^8",
216216
"@typescript-eslint/parser":"^8",
217+
"@vscode/vsce":"^3.x",
217218
"esbuild":"^0.24",
218219
"eslint":"^9.12",
219-
"typescript":"5.5.x",
220-
"@vscode/vsce":"^3.x"
220+
"typescript":"5.5.x"
221+
},
222+
"dependencies": {
223+
"@stylistic/eslint-plugin":"^2.9.0"
221224
}
222225
}

‎src/cxxrtl/client.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,25 @@ export class Connection {
4545
}
4646

4747
privatetraceSend(packet:proto.ClientPacket){
48-
this.timestamps.push(newDate());
4948
if(packet.type==='greeting'){
50-
console.debug(`[CXXRTL] C>S`,packet);
49+
console.debug('[CXXRTL] C>S',packet);
5150
}elseif(packet.type==='command'){
51+
this.timestamps.push(newDate());
5252
console.debug(`[CXXRTL] C>S#${this.sendIndex++}`,packet);
5353
}
5454
}
5555

5656
privatetraceRecv(packet:proto.ServerPacket){
5757
if(packet.type==='greeting'){
58-
console.debug(`[CXXRTL] S>C`,packet);
58+
console.debug('[CXXRTL] S>C',packet);
5959
}elseif(packet.type==='response'){
6060
constelapsed=newDate().getTime()-this.timestamps.shift()!.getTime();
6161
console.debug(`[CXXRTL] S>C#${this.recvIndex++}`,packet,`(${elapsed}ms)`);
6262
}elseif(packet.type==='error'){
6363
this.timestamps.shift();
6464
console.error(`[CXXRTL] S>C#${this.recvIndex++}`,packet);
6565
}elseif(packet.type==='event'){
66-
console.debug(`[CXXRTL] S>C`,packet);
66+
console.debug('[CXXRTL] S>C',packet);
6767
}
6868
}
6969

‎src/cxxrtl/link.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface ILink {
99
onDone:()=>Promise<void>;
1010

1111
send(packet:proto.ClientPacket):Promise<void>;
12-
};
12+
}
1313

1414
exportclassMockLinkimplementsILink{
1515
constructor(

‎src/debugger.ts‎

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TimeInterval, TimePoint } from './model/time';
66
import{Scope}from'./model/scope';
77
import{Variable}from'./model/variable';
88
import{StatusBarItem}from'./ui/status';
9-
import{BoundReference,Reference,Sample}from'./model/sample';
9+
import{Reference,UnboundReference,Sample}from'./model/sample';
1010

1111
exportenumCXXRTLSimulationStatus{
1212
Paused='paused',
@@ -28,12 +28,16 @@ export class CXXRTLDebugger {
2828
// Session properties.
2929

3030
private_sessionStatus:CXXRTLSessionStatus=CXXRTLSessionStatus.Absent;
31-
publicgetsessionStatus(){returnthis._sessionStatus;}
31+
publicgetsessionStatus(){
32+
returnthis._sessionStatus;
33+
}
3234
private_onDidChangeSessionStatus:vscode.EventEmitter<CXXRTLSessionStatus>=newvscode.EventEmitter<CXXRTLSessionStatus>();
3335
readonlyonDidChangeSessionStatus:vscode.Event<CXXRTLSessionStatus>=this._onDidChangeSessionStatus.event;
3436

3537
private_currentTime:TimePoint=newTimePoint(0n,0n);
36-
publicgetcurrentTime(){returnthis._currentTime;}
38+
publicgetcurrentTime(){
39+
returnthis._currentTime;
40+
}
3741
private_onDidChangeCurrentTime:vscode.EventEmitter<TimePoint>=newvscode.EventEmitter<TimePoint>();
3842
readonlyonDidChangeCurrentTime:vscode.Event<TimePoint>=this._onDidChangeCurrentTime.event;
3943

@@ -42,12 +46,16 @@ export class CXXRTLDebugger {
4246
privatesimulationStatusUpdateTimeout:NodeJS.Timeout|null=null;
4347

4448
private_simulationStatus:CXXRTLSimulationStatus=CXXRTLSimulationStatus.Finished;
45-
publicgetsimulationStatus(){returnthis._simulationStatus;}
49+
publicgetsimulationStatus(){
50+
returnthis._simulationStatus;
51+
}
4652
private_onDidChangeSimulationStatus:vscode.EventEmitter<CXXRTLSimulationStatus>=newvscode.EventEmitter<CXXRTLSimulationStatus>();
4753
readonlyonDidChangeSimulationStatus:vscode.Event<CXXRTLSimulationStatus>=this._onDidChangeSimulationStatus.event;
4854

4955
private_latestTime:TimePoint=newTimePoint(0n,0n);
50-
publicgetlatestTime(){returnthis._latestTime;}
56+
publicgetlatestTime(){
57+
returnthis._latestTime;
58+
}
5159
private_onDidChangeLatestTime:vscode.EventEmitter<TimePoint>=newvscode.EventEmitter<TimePoint>();
5260
readonlyonDidChangeLatestTime:vscode.Event<TimePoint>=this._onDidChangeLatestTime.event;
5361

@@ -63,7 +71,7 @@ export class CXXRTLDebugger {
6371

6472
publicasyncstartSession():Promise<void>{
6573
if(this.terminal!==null){
66-
vscode.window.showErrorMessage("A debug session is already in the process of being started.");
74+
vscode.window.showErrorMessage('A debug session is already in the process of being started.');
6775
return;
6876
}
6977

@@ -81,39 +89,39 @@ export class CXXRTLDebugger {
8189
this.setSessionStatus(CXXRTLSessionStatus.Starting);
8290

8391
constprocessId=awaitthis.terminal.processId;
84-
console.log("[RTL Debugger] Launched process %d",processId);
92+
console.log('[RTL Debugger] Launched process %d',processId);
8593

8694
setTimeout(()=>{
8795
constsocket=net.createConnection({port:configuration.port,host:'::1'},()=>{
88-
vscode.window.showInformationMessage("Connected to the CXXRTL server.");
96+
vscode.window.showInformationMessage('Connected to the CXXRTL server.');
8997

9098
(async()=>{
9199
this.connection=newConnection(newNodeStreamLink(socket));
92100
this.setSessionStatus(CXXRTLSessionStatus.Running);
93101
this.updateSimulationStatus();
94-
console.log("[RTL Debugger] Initialized");
102+
console.log('[RTL Debugger] Initialized');
95103
})().catch(()=>{
96104
this.stopSession();
97105
});
98106
});
99107
socket.on('error',(err:any)=>{
100108
if(err.code==='ECONNREFUSED'){
101-
vscode.window.showErrorMessage("The connection to the CXXRTL server was refused.");
109+
vscode.window.showErrorMessage('The connection to the CXXRTL server was refused.');
102110
}else{
103111
vscode.window.showErrorMessage(`The connection to the CXXRTL server has failed:${err.code}.`);
104112
}
105113
this.stopSession();
106114
});
107115
socket.on('close',(hadError)=>{
108116
if(!hadError){
109-
vscode.window.showInformationMessage("Disconnected from the CXXRTL server.");
117+
vscode.window.showInformationMessage('Disconnected from the CXXRTL server.');
110118
}
111119
this.stopSession();
112120
});
113121
},500);// FIXME
114122
}else{
115-
constOpenSettings="Open Settings";
116-
constselection=awaitvscode.window.showErrorMessage("Configure the launch command to start a debug session.",OpenSettings);
123+
constOpenSettings='Open Settings';
124+
constselection=awaitvscode.window.showErrorMessage('Configure the launch command to start a debug session.',OpenSettings);
117125
if(selection===OpenSettings){
118126
vscode.commands.executeCommand('workbench.action.openSettings','rtlDebugger.command');
119127
}
@@ -254,7 +262,7 @@ export class CXXRTLDebugger {
254262
for(const[cxxrtlName,cxxrtlDesc]ofObject.entries(cxxrtlResponse.scopes)){
255263
constnestedScopes:Scope[]=[];
256264
constnestedVariables:Thenable<Variable[]>={
257-
//NormallyPromises are evaluated eagerly; this Thenable does it lazily.
265+
//Normally Promises are evaluated eagerly; this Thenable does it lazily.
258266
then:(onfulfilled,onrejected)=>{
259267
returnthis.getVariablesForScope(cxxrtlName).then(onfulfilled,onrejected);
260268
}
@@ -292,7 +300,7 @@ export class CXXRTLDebugger {
292300
}
293301
}
294302

295-
publicbindReference(name:string,reference:Reference):BoundReference{
303+
publicbindReference(name:string,reference:UnboundReference):Reference{
296304
constepoch=this.advanceReferenceEpoch(name);
297305
// Note that we do not wait for the command to complete. Although it is possible for
298306
// the command to fail, this would only happen if one of the designations is invalid,
@@ -303,13 +311,13 @@ export class CXXRTLDebugger {
303311
reference:name,
304312
items:reference.cxxrtlItemDesignations()
305313
}).catch((error)=>{
306-
console.error(`[CXXRTL] invalid designation while binding reference`,
314+
console.error('[CXXRTL] invalid designation while binding reference',
307315
`${name}#${epoch}`,error);
308316
});
309-
returnnewBoundReference(name,epoch,reference);
317+
returnnewReference(name,epoch,reference);
310318
}
311319

312-
publicasyncqueryInterval(interval:TimeInterval,reference:BoundReference):Promise<Sample[]>{
320+
publicasyncqueryInterval(interval:TimeInterval,reference:Reference):Promise<Sample[]>{
313321
this.verifyReferenceEpoch(reference.name,reference.epoch);
314322
constcxxrtlResponse=awaitthis.connection!.queryInterval({
315323
type:'command',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp