Skip to content

Commit 47fff9f

Browse files
Tracing (#226)
* bump api * tracing (wip) * wip * mostly working * small fixes * wip * try to fix profile converter
1 parent ca4c26f commit 47fff9f

File tree

20 files changed

+501
-34
lines changed

20 files changed

+501
-34
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"address": "localhost",
3131
"smartStep": true,
3232
"showAsyncStacks": true,
33+
"restart": true,
3334
"skipFiles": [
3435
"<node_internals>/**"
3536
],

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## [1.7.14] 2024-10-23
4+
5+
### Added
6+
7+
- display performance traces
8+
39
## [1.7.12] 2024-09-23
410

511
### Fixed

client/package-lock.json

Lines changed: 90 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"tmp-promise": "^3.0.3",
8282
"tough-cookie": "^4.1.2",
8383
"uuid": "^9.0.0",
84+
"v8-inspect-profiler": "^0.1.0",
8485
"vscode-abap-remote-fs-sharedapi": "file:../modules/sharedapi",
8586
"vscode-debugadapter": "^1.51.0",
8687
"vscode-debugprotocol": "^1.51.0",

client/src/adt/classhierarchy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ export class ClassHierarchyLensProvider implements CodeLensProvider {
127127
public async provideCodeLenses(doc: TextDocument, token: CancellationToken): Promise<CodeLens[]> {
128128
const lenses: CodeLens[] = []
129129
if (doc.uri.scheme !== ADTSCHEME) return lenses
130-
const client = getClient(doc.uri.authority)
131130
const obj = await findAbapObject(doc.uri)
132131
if (!obj) return lenses
133132
// TODO stat?

client/src/adt/operations/AdtObjectFinder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ export function createUri(connId: string, path: string, query: string = "") {
255255
})
256256
}
257257

258-
export function findAbapObject(uri: Uri) {
259-
const file = uriRoot(uri).getNode(uri.path)
258+
export async function findAbapObject(uri: Uri) {
259+
const file = await uriRoot(uri).getNodeAsync(uri.path)
260260
if (isAbapStat(file)) return file.object
261261
throw new Error("Not an ABAP object")
262262
}

client/src/commands/commands.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import {
44
Uri,
55
window,
66
commands,
7-
ProgressLocation
7+
ProgressLocation,
8+
Position,
9+
Range
810
} from "vscode"
911
import { pickAdtRoot, RemoteManager } from "../config"
10-
import { caughtToString, log } from "../lib"
12+
import { caughtToString, lineRange, log, splitAdtUri } from "../lib"
1113
import { FavouritesProvider, FavItem } from "../views/favourites"
12-
import { findEditor } from "../langClient"
14+
import { findEditor, vsCodeUri } from "../langClient"
1315
import { showHideActivate } from "../listeners"
1416
import { UnitTestRunner } from "../adt/operations/UnitTestRunner"
1517
import { selectTransport } from "../adt/AdtTransports"
@@ -80,7 +82,10 @@ export function openObject(connId: string, uri: string) {
8082
}
8183
)
8284
}
83-
85+
interface ShowObjectArgument {
86+
connId: string,
87+
uri: string
88+
}
8489
export class AdtCommands {
8590
@command(AbapFsCommands.showDocumentation)
8691
private static async showAbapDoc() {
@@ -152,7 +157,7 @@ export class AdtCommands {
152157
await window.withProgress(
153158
{ location: ProgressLocation.Window, title: "Activating..." },
154159
async () => {
155-
const obj = findAbapObject(uri)
160+
const obj = await findAbapObject(uri)
156161
// if editor is dirty, save before activate
157162
if (editor && editor.document.isDirty) {
158163
const saved = await editor.document.save()
@@ -247,7 +252,15 @@ export class AdtCommands {
247252
return window.showErrorMessage(caughtToString(e))
248253
}
249254
}
250-
255+
@command(AbapFsCommands.showObject)
256+
private static async showObject(arg: ShowObjectArgument) {
257+
const p = splitAdtUri(arg.uri)
258+
const path = await vsCodeUri(arg.connId, arg.uri, true, true)
259+
const uri = Uri.parse(path)
260+
const doc = await workspace.openTextDocument(uri)
261+
const selection = p.start?.line ? lineRange(p.start?.line + 1) : undefined
262+
window.showTextDocument(doc, { selection })
263+
}
251264
@command(AbapFsCommands.runInGui)
252265
private static async executeAbap() {
253266
try {

client/src/commands/registry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ export const AbapFsCommands = {
7676
agitAdd: "abapfs.addAbapGit",
7777
agitRemove: "abapfs.removeAbapGit",
7878
agitresetPwd: "abapfs.resetAbapGitPwd",
79-
agitBranch: "abapfs.switchBranch"
79+
agitBranch: "abapfs.switchBranch",
80+
//traces
81+
refreshTraces: "abapfs.refreshTraces",
82+
deleteTrace: "abapfs.deleteTrace",
8083
}
8184

8285
export const abapcmds: {

client/src/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { HttpProvider } from "./editors/httpprovider"
3232
import { dumpProvider } from "./views/dumps/dumps"
3333
import { registerAbapDebugger } from "./adt/debugger"
3434
import { ATCDocumentation } from "./views/abaptestcockpit/documentation"
35+
import { tracesProvider } from "./views/traces"
3536

3637
export let context: ExtensionContext
3738

@@ -72,6 +73,7 @@ export async function activate(ctx: ExtensionContext): Promise<AbapFsApi> {
7273
sub.push(window.registerTreeDataProvider("abapfs.abapgit", abapGitProvider))
7374
sub.push(window.registerTreeDataProvider("abapfs.dumps", dumpProvider))
7475
sub.push(window.registerTreeDataProvider("abapfs.atcFinds", atcProvider))
76+
sub.push(window.registerTreeDataProvider("abapfs.traces", tracesProvider))
7577
sub.push(
7678
languages.registerCodeLensProvider(
7779
{ language: "abap", scheme: ADTSCHEME },

client/src/views/abaptestcockpit/view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ADTClient, AtcWorkList } from "abap-adt-api"
1+
import { AtcWorkList } from "abap-adt-api"
22
import { Task } from "fp-ts/lib/Task"
33
import { commands, Disposable, EventEmitter, Position, TextDocumentContentChangeEvent, ThemeColor, ThemeIcon, TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri, window } from "vscode"
44
import { getClient } from "../../adt/conections"

0 commit comments

Comments
 (0)