Skip to content

LT-21517: Implement DialogInsertItemInVector in Pub/Sub system#836

Merged
mark-sil merged 2 commits intomainfrom
LT-21517
Apr 15, 2026
Merged

LT-21517: Implement DialogInsertItemInVector in Pub/Sub system#836
mark-sil merged 2 commits intomainfrom
LT-21517

Conversation

@mark-sil
Copy link
Copy Markdown
Contributor

@mark-sil mark-sil commented Apr 14, 2026

Add a ReturnObject class to return a ‘handled’ value, which the Publisher needs to know. All of the Subscribers only handle a specific className or className and Id combination so it did not matter that two of the classes are derived from DlgListenerBase, which has ColleaguePriority.High.


This change is Reviewable

Add a ReturnObject class to return a ‘handled’ value, which the
Publisher needs to know. All of the Subscribers only handle a
specific className or className and Id combination so it did not
matter that two of the classes are derived from DlgListenerBase,
which has ColleaguePriority.High.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

NUnit Tests

    1 files  ±0      1 suites  ±0   6m 21s ⏱️ -11s
4 103 tests ±0  4 032 ✅ ±0  71 💤 ±0  0 ❌ ±0 
4 112 runs  ±0  4 041 ✅ ±0  71 💤 ±0  0 ❌ ±0 

Results for commit a908ab6. ± Comparison against base commit 6666312.

♻️ This comment has been updated with latest results.

}
// Only handle "LexEntry" class.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if (className == null || className != "LexEntry")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're in the area, className == null is redundant to className != "LexEntry"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return;
}
// Only handle "FsClosedFeature" for "CmdInsertPhonologicalClosedFeature".
if (className == "FsClosedFeature" && command.Id != "CmdInsertPhonologicalClosedFeature")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just checked className == "FsClosedFeature".

If you want to clean up, you could combine these two if statements.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if (!(obj is ReturnObject retObj) ||
!(retObj.Data is Command command))
{
Debug.Assert(false, "Received unexpected object type.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could use Debug.Fail or even a yellow-box crash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code had an Assert to check Command, I think leaving it as an Assert but also checking ReturnObject is sufficient. It doesn't seem like it needs to change.

}

public object Data { get; set; }
public bool ReturnValue { get; set; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would Handled be a better name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I agree, Handled is a better name, but my intent is for this to be generic so the next time it is used it also makes sense, which might be something other than Handled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure Handled is the only case, but ReturnValue is acceptable.

Copy link
Copy Markdown
Contributor

@papeh papeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@papeh reviewed 11 files and all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on mark-sil).

Copy link
Copy Markdown
Contributor Author

@mark-sil mark-sil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-sil made 4 comments.
Reviewable status: 6 of 11 files reviewed, 4 unresolved discussions (waiting on papeh).

}

public object Data { get; set; }
public bool ReturnValue { get; set; }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I agree, Handled is a better name, but my intent is for this to be generic so the next time it is used it also makes sense, which might be something other than Handled.

if (!(obj is ReturnObject retObj) ||
!(retObj.Data is Command command))
{
Debug.Assert(false, "Received unexpected object type.");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code had an Assert to check Command, I think leaving it as an Assert but also checking ReturnObject is sufficient. It doesn't seem like it needs to change.

}
// Only handle "LexEntry" class.
string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
if (className == null || className != "LexEntry")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return;
}
// Only handle "FsClosedFeature" for "CmdInsertPhonologicalClosedFeature".
if (className == "FsClosedFeature" && command.Id != "CmdInsertPhonologicalClosedFeature")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mark-sil mark-sil merged commit 90d4933 into main Apr 15, 2026
6 of 7 checks passed
@mark-sil mark-sil deleted the LT-21517 branch April 15, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants