Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add datasources to the extension ui #147

Merged
merged 6 commits into from
Dec 3, 2024
Merged

Conversation

OvidiuCode
Copy link
Contributor

@OvidiuCode OvidiuCode commented Dec 3, 2024

Stable release checklist:

  • Updated the version using python -m dev set-version {version}
  • Updated /docs/changelog.md with the changes for the release

Pre-release checklist:

  • Updated the Unreleased section of /docs/changelog.md with the new changes.
image

@OvidiuCode OvidiuCode self-assigned this Dec 3, 2024
@OvidiuCode OvidiuCode requested a review from fabioz December 3, 2024 11:35
yield node, decorator.id
yield {"node": node, "kind": decorator.id}

elif isinstance(node, ast_module.Assign):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be easier if you did something as:

    for _stack, node in _iter_nodes(ast, recursive=False):
        if isinstance(node, ast_module.Call) and isinstance(call_node.func, ast_module.Name) and call_node.func.id == "DataSourceSpec":
            ... # i.e.: Any call to `DataSourceSpec` would be gotten.

The issue in the current code is that it'll match something as x = Annotated[DataSource, DataSourceSpec(...)], but then not x = typing.Annotated[...] because it's an Attribute, not a Name.

@@ -230,30 +230,49 @@ export class RobotsTreeDataProvider implements vscode.TreeDataProvider<RobotEntr
}
);
if (result.success) {
let actions: IActionInfo[] = result.result;
let actionsAndDatasources: IActionInfo[] = result.result;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: the method askForActionPackageAndAction in actionPackage.ts also calls roboCommands.SEMA4AI_LIST_ACTIONS_INTERNAL, but it doesn't care about datasources (so, with this PR it'll do the wrong thing)... Maybe we should leave SEMA4AI_LIST_ACTIONS_INTERNAL as is and create a SEMA4AI_LIST_ACTIONS_AND_DATASOURCES_INTERNAL.... or alternatively add a bool saying collect_datasources=true|false (default being false not to break compatibility in the other use case).

"end": {
"line": node.lineno,
"character": node.col_offset + coldelta + len(node.name),
"line": node.end_lineno or func_node.lineno,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really get this one: since we just want the name coordinates, why isn't it directly func_node.end_lineno / func_node.end_col_offset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is because of linting. It seems that node.end_lineno is int | None while we always expect a number. In our case it will probably never be None, or will be if there is a mistake (e.g: function not closed) so then we default to the start line.

@fabioz fabioz merged commit 393e349 into master Dec 3, 2024
9 checks passed
@fabioz fabioz deleted the feature/datasources-ui branch December 3, 2024 18:25
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