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

[WIP / DO NOT MERGE] Initial LSP implementation #1573

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-cgorrie
Copy link
Contributor

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

This is the initial LSP implementation that has not yet been refactored to use fork_cli_context. It does not currently function correctly.

from snowflake.cli.api.output.types import MessageResult
from snowflake.cli.api.project.definition_manager import DefinitionManager
from snowflake.cli.plugins.lsp.server import lsp_plugin
from snowflake.cli.plugins.nativeapp.manager import NativeAppManagern

Choose a reason for hiding this comment

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

broken import, typo

Choose a reason for hiding this comment

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

Suggested change
from snowflake.cli.plugins.nativeapp.manager import NativeAppManagern
from snowflake.cli._plugins.nativeapp.manager import NativeAppManager

from snowflake.cli.api.cli_global_context import get_cli_context
from snowflake.cli.api.output.types import MessageResult
from snowflake.cli.api.project.definition_manager import DefinitionManager
from snowflake.cli.plugins.lsp.server import lsp_plugin

Choose a reason for hiding this comment

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

broken import, lsp_plugin does not exist

raise ValueError("Expected exactly one CommandArguments object")

try:
args = TypeAdapter(CommandArguments).validate_python(params[0] if len(params) == 1 else {})

Choose a reason for hiding this comment

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

I would explicitly handle unexpected args, at least I would log the event, silently continuing could make it very hard to debug something unexpected

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.

3 participants