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

Made progress on leoserver, this probably Fixes #3898 AND Fixes #3918 #3919

Merged
merged 7 commits into from
May 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions leo/core/leoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2407,14 +2407,7 @@ def row_col_pv_dict(i: int, s: str) -> dict:
# Handle @killcolor and @nocolor-node when looking for language
if c.frame.body.colorizer.useSyntaxColoring(p):
# Get the language.
aList = g.get_directives_dict_list(p)
d = g.scanAtCommentAndAtLanguageDirectives(aList)
language = (
d and d.get('language')
or g.getLanguageFromAncestorAtFileNode(p)
or c.config.getLanguage('target-language')
or 'plain'
)
language = g.getLanguageFromAncestorAtFileNode(p) or c.config.getLanguage('target-language')
else:
# No coloring at all for this node.
language = 'plain'
Expand Down Expand Up @@ -4961,6 +4954,12 @@ def _get_p(self, param: dict) -> Position:
p = self._ap_to_p(ap, c) # Conversion
if p:
if not c.positionExists(p): # pragma: no cover
# Try to get a gnx parameter as secondary fallback selection criteria
gnx = param.get("gnx")
if gnx:
for p in c.all_unique_positions():
if p.v.gnx == gnx:
return p
raise ServerError(f"{tag}: position does not exist. ap: {ap!r}")
return p # Return the position
# Fallback to c.p
Expand Down