File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,3 +95,8 @@ def get_keywords_from_tokenizer(dialect: t.Optional[str] = None) -> t.Set[str]:
9595 parts = keyword .split (" " )
9696 expanded_keywords .update (parts )
9797 return expanded_keywords
98+
99+
100+ def get_macros_completions (context : t .Optional [LSPContext ]) -> t .Set [str ]:
101+ macros = context .context ._macros
102+
Original file line number Diff line number Diff line change 11import pytest
22from sqlglot import Tokenizer
33from sqlmesh .core .context import Context
4- from sqlmesh .lsp .completions import get_keywords_from_tokenizer , get_sql_completions
4+ from sqlmesh .lsp .completions import get_keywords_from_tokenizer , get_sql_completions , get_macros_completions
55from sqlmesh .lsp .context import LSPContext
66from sqlmesh .lsp .uri import URI
77
@@ -41,3 +41,11 @@ def test_get_sql_completions_with_context_and_file_uri():
4141 completions = get_sql_completions (lsp_context , URI .from_path (file_uri ))
4242 assert len (completions .keywords ) > len (TOKENIZER_KEYWORDS )
4343 assert "sushi.active_customers" not in completions .models
44+
45+ @pytest .mark .fast
46+ def test_macros_completions ():
47+ context = Context (paths = ["examples/sushi" ])
48+ lsp_context = LSPContext (context )
49+
50+ completions = get_macros_completions (lsp_context )
51+
You can’t perform that action at this time.
0 commit comments