Repository navigation
Export the FunctionElement catalog-rename carry, so a host that renames in the catalog itself can carry a function rename - #119
Merged
Conversation
…name into the catalog Maintainer ruling A5: a FunctionElement rename also renames the System Composer interface dictionary's copy (p_Name / p_FunctionPrototype), through the existing catalog-rename code, in both formats. #109 does this in the session's save. vscode never saves through the session. Its two editors carry a catalog rename into the open document when the edit is made, using the barrel's scanScJsonText / scanScXml and scRenameEdits, and the barrel had nothing for a function. So the barrel now exports what #109 built, with no new logic: - scFunctionRenameEdits(text, fns, renames): ScTextEdit[]. This is #109's private functionRenameEdits, renamed to the barrel's sc* spelling. Both save writers call it under the new name. - scanScJsonFunctions(text) and scanScXmlFunctions(xml): ScFunction[]. - The types ScFunction and CatalogFunctionRenames. ScNameSite and ScTextEdit, which these signatures reference, were already exported. The private // comments become doc comments. ScFunction's fields get docs, and the JSON scanner's "The same, ..." is spelled out, because a hover shows each doc on its own. Tests: scCatalog.test.ts gets 6 barrel tests, covering both formats, a catalog Prototype that cannot follow, the guards, and a carry made one rename at a time that equals the save's one pass. publicTypeSurface.test.ts gets 1 compiled consumer of the types. No existing test changes. dist/ is regenerated.
…der the edits come in CatalogFunctionRenames described only the session's own record, keyed by the names in the file as read; a host that carries a rename into its open text keys by the names that text spells now, and the doc now says both. scFunctionRenameEdits returns its edits in scan order rather than ascending position, unlike scRenameEdits; applyScEdits sorts them, and the doc now says so. Comments only: the emitted JavaScript differs in comments alone.
Merged
ww-mw
added a commit
to mathworks/data-explorer-vscode
that referenced
this pull request
Oct 16, 2026
data-explorer-core v1.39.0 (mathworks/data-explorer-core#119, released in #120 there) exports scFunctionRenameEdits, scanScJsonFunctions, scanScXmlFunctions and the ScFunction and CatalogFunctionRenames types from its barrel, which the previous commit calls to carry a FunctionElement rename into the System Composer catalog. The lockfile changes only core's entries: the root dependency spec and node_modules/data-explorer-core, now 1.39.0 resolved at 8e334082682eae7901cc07016f4fb90b3cdc7c73.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why vscode needs this
#109 implements A5 inside core. The session records each function rename beside the catalog, and both save writers (
scJsonTextWithRenames,scXmlWithRenames) turn that record into edits. The VS Code extension never saves through the session:Both editors carry a catalog rename into the document when the edit is made, using the barrel's
scanScJsonText/scanScXml+scRenameEdits. Those know entry names only, and the gate in front of them (catalogRenameOf) passes only a rename of a top-level entry. So in vscode a FunctionElement rename updates the data part and leaves the catalog'sp_Name f/y = f(u,v)as they were read. When the file is reopened, MATLAB's interface dictionary disagrees with the data part.#109's body left this for a vscode follow-up because it needs a wider barrel. This PR widens it. The vscode half adds one gate and one branch per editor that call these exports.
What is exported
No new logic. These are the functions #109 built, made public:
scFunctionRenameEdits(text, fns, renames): ScTextEdit[]functionRenameEdits, renamed to the barrel'ssc*spelling (besidescRenameEdits). Both save writers call it under the new name.scanScJsonFunctions(text): ScFunction[]scanScXmlFunctions(xml): ScFunction[]interfaceDictionary.xmlmember.type ScFunction{ interfaceName; name; nameSite: ScNameSite; prototypeSite: ScNameSite | null }type CatalogFunctionRenamesReadonlyMap<string, ReadonlyMap<string, string>>. It was already exported fromScCatalog.ts, and is now on the barrel too.ScNameSiteandScTextEdit, which these signatures reference, were already on the barrel.The private
//comments become doc comments. Two deviations from a word-for-word promotion, both because a hover shows each doc on its own:scanScJsonFunctionsspells out its opening "The same, ...".ScFunction's fields get one-line docs.The barrel's System Composer block gets one sentence, naming these as the way a host carries a function rename.
Not exported:
renameFunctionInCatalog/catalogFunctionRenames. They record renames since the read, keyed by the names in the file. vscode rewrites its document at every edit, so that record goes stale.scXmlWithRenames/scJsonTextWithRenames. They return a whole text, and the text editor needs ranges for oneWorkspaceEdit.src/datamodel/parser/ScCatalog.tsandsrc/index.tschange, anddist/is regenerated. Exactly 8 dist files change:ScCatalogandindex,.js/.d.tsand their maps. A rebuild of unmodifiedmainreproduceddist/byte for byte, so these 8 files come from this change alone.Tests
test/scCatalog.test.ts, a newdescribe('a host carries a function rename with the barrel')that imports through../src/index.js, as the file's other tests do (6 tests):arch.sldd): the scan listsServiceInterface'sfandf1, and notf2, which was added without System Composer. Renamingftocomputegives exactly two edits, at the catalog's"p_Name"and"p_FunctionPrototype". The data part is left to the host's own splice. The result is byte-equal toscJsonTextWithRenamesfor the same rename.functionElementRename.test.ts's catalog member (theexample/dd1.slddshape), copied rather than moved so that no existing test changes. The data interface namedfandg's argumentgstay as read. The result is byte-equal toscXmlWithRenames.p_Namestill moves, and the Prototype keeps its text, as the save writes it.test/publicTypeSurface.test.tsgets 1 compiled consumer that namesScFunction,CatalogFunctionRenames,ScNameSiteandScTextEdit. vitest erases type-only imports, so only this test can catch a missing type export.Fail-before: I ran the new tests against
main's source. All 7 fail, and the 42 existing tests in those two files pass:TypeError: scanScJsonFunctions is not a function(orscanScXmlFunctions).A mutant that writes the Prototype even when it cannot follow fails exactly the "cannot follow" test.
No behaviour change: no existing test is modified. The test diffs add lines only, and
publicTypeSurfacedoes not enumerate exported names. #109's tests infunctionElementRename.test.tspass unchanged, which covers the renamed call sites.Gate
npm run verifyis green: typecheck, build, smoke, test,check:pack,check:leakandcheck:browser.main(b8c3f2b): 238 files passed, 1 skipped; 7,922 tests passed, 26 skipped. That is +7, the new tests.Part of the maintainer's A5 ruling; the vscode half follows once this is tagged.
After review.
55b65f8corrects two doc comments the API reviewer flagged as non-blocking:CatalogFunctionRenamesnow says how a host keys it (by the names its open text spells), not only how the session's record does; andscFunctionRenameEditssays its edits come in scan order, whichapplyScEditssorts. Comments only; verify 7929 passed / 26 skipped;distrebuilt.