Skip to content

Commit 0c602c5

Browse files
committed
fixup: add stringIsEmpty helper (used by rsr-certifier no-workspace checks)
1 parent 8c62b2e commit 0c602c5

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/affine-vscode/mod.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ module.exports = function makeVscodeBindings(vscode, lcModule, hostShim) {
150150
const out = s.endsWith(suffix) ? s.slice(0, -suffix.length) + replacement : s;
151151
return reg(out);
152152
},
153+
stringIsEmpty: (sPtr) => readString(sPtr).length === 0 ? 1 : 0,
153154

154155
// ── Workspace ───────────────────────────────────────────────────
155156
workspaceFolderFirstPath: () => {

stdlib/Vscode.affine

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ pub extern fn stringReplaceSuffix(s: String,
130130
suffix: String,
131131
replacement: String) -> String;
132132

133+
/// Returns 1 if `s` has zero length, 0 otherwise. Useful for testing the
134+
/// "no result" sentinel returned by getters like `workspaceFolderFirstPath`
135+
/// without needing a String=String primitive in the AffineScript surface.
136+
pub extern fn stringIsEmpty(s: String) -> Int;
137+
133138
// ── Workspace ─────────────────────────────────────────────────────────
134139

135140
/// First workspace folder's `uri.fsPath`, or "" if there is no workspace.

0 commit comments

Comments
 (0)