sqlakit-lsp 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/PKG-INFO +1 -1
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/pyproject.toml +1 -1
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/pyproject.toml.orig +1 -1
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/sqlakit_lsp/_server.py +15 -3
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/LICENSE +0 -0
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/README.md +0 -0
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/sqlakit_lsp/__init__.py +0 -0
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/sqlakit_lsp/__main__.py +0 -0
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/sqlakit_lsp/_cli.py +0 -0
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/sqlakit_lsp/_live.py +0 -0
- {sqlakit_lsp-0.3.1 → sqlakit_lsp-0.3.2}/sqlakit_lsp/py.typed +0 -0
|
@@ -973,12 +973,24 @@ class _Assistant:
|
|
|
973
973
|
continue
|
|
974
974
|
names = alone.parameters()
|
|
975
975
|
given = _rendered(alone, dialect, dict.fromkeys(names, _Example()))
|
|
976
|
-
if names and given
|
|
976
|
+
if names and self._kept(given, call.name):
|
|
977
977
|
missing = _rendered(alone, dialect, dict.fromkeys(names))
|
|
978
|
-
if
|
|
978
|
+
if not self._kept(missing, call.name):
|
|
979
979
|
found.update(names)
|
|
980
980
|
return found
|
|
981
981
|
|
|
982
|
+
def _kept(self, sql: str | None, macro: str) -> bool:
|
|
983
|
+
"""Whether a call rendered alone could not be made, and wrote itself.
|
|
984
|
+
|
|
985
|
+
It writes itself on one line, whatever lines it was written on.
|
|
986
|
+
"""
|
|
987
|
+
if sql is None:
|
|
988
|
+
return True
|
|
989
|
+
namespace = re.escape(self.project.templates.namespace)
|
|
990
|
+
return bool(
|
|
991
|
+
re.match(rf"{namespace}\.{re.escape(macro)}\s*\(", sql, re.IGNORECASE)
|
|
992
|
+
)
|
|
993
|
+
|
|
982
994
|
def holds_macros(self, path: Path) -> bool:
|
|
983
995
|
"""Whether a file defines macros: SQL macros, or the SQL of a file macro."""
|
|
984
996
|
return self._reads_macros(path) or path.resolve() in self._macro_sql
|
|
@@ -1061,7 +1073,7 @@ class _Assistant:
|
|
|
1061
1073
|
missing = _rendered(alone, dialect, dict.fromkeys(names))
|
|
1062
1074
|
# A call that cannot be made writes itself, which says nothing new.
|
|
1063
1075
|
given, missing = (
|
|
1064
|
-
None if one
|
|
1076
|
+
None if self._kept(one, call.name) else one for one in (given, missing)
|
|
1065
1077
|
)
|
|
1066
1078
|
if not names or given == missing:
|
|
1067
1079
|
one = given or missing
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|