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

Basic implementation of language server #7326

Merged
merged 6 commits into from May 23, 2024
Merged

Basic implementation of language server #7326

merged 6 commits into from May 23, 2024

Conversation

aljazerzen
Copy link
Contributor

@aljazerzen aljazerzen commented May 9, 2024

This PR adds a language server can be started by python -m edb.language_server.main which will then speak LSP over stdin and stdout streams.

It will:

  • parse and report any syntactic errors in the opened edgedb files,
  • find dbschema/ directory in the workspace,
  • parse and compile the schema,
  • compile and edgedb files against that schema,
  • if any DDL is found, it will apply that DDL during each file compilation.

Example:

# dbschema/default.esdl

module default {
    type Player {
        property username: str;
    };
};
# a.edgeql

create TYPE Clan {
    create property name -> str;
};

alter type Player {
    create required LINK clan: Clan;
};

select default::Player {
    username,
    clan: {
        name
    }
}
filter .username ilike '%pickle%' and .age > 10;

image

TODO:

  • when a schema is changed, recompile it

@aljazerzen aljazerzen requested a review from msullivan May 9, 2024 19:45
@aljazerzen aljazerzen changed the title language server Basic implementation of language server May 9, 2024
@aljazerzen
Copy link
Contributor Author

To check it out, one must:

  • checkout this PR into your dev env,
  • checkout language-server branch of edgedb-editor-plugin,
  • edgedb-editor-plugin in vscode, using the same python venv that your dev env is installed in,
  • launch "Run Extension" task,
  • now a new vscode window should open and you can navigate to an edgedb project.

pyproject.toml Outdated Show resolved Hide resolved
@msullivan
Copy link
Member

What should we do to test this? Some tests that talk to the language server directly?

@aljazerzen
Copy link
Contributor Author

Probably yes. Run python -m edb.language_server.main in a subprocess and feed it LSP requests.

@aljazerzen aljazerzen merged commit 6d42241 into master May 23, 2024
23 checks passed
@aljazerzen aljazerzen deleted the language-server branch May 23, 2024 18:29
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.

None yet

3 participants