Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ecopilot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ula
research
ecopilot
Commits
0e91c720
Commit
0e91c720
authored
3 months ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Add custom output styling for ecopilot_srcindex
parent
435cffec
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ecopilot_srcindex/repomap.py
+30
-2
30 additions, 2 deletions
ecopilot_srcindex/repomap.py
with
30 additions
and
2 deletions
ecopilot_srcindex/repomap.py
+
30
−
2
View file @
0e91c720
...
@@ -28,6 +28,34 @@ Tag = namedtuple("Tag", "rel_fname fname line name kind".split())
...
@@ -28,6 +28,34 @@ Tag = namedtuple("Tag", "rel_fname fname line name kind".split())
SQLITE_ERRORS
=
(
sqlite3
.
OperationalError
,
sqlite3
.
DatabaseError
,
OSError
)
SQLITE_ERRORS
=
(
sqlite3
.
OperationalError
,
sqlite3
.
DatabaseError
,
OSError
)
# Provide custom output styling.
class
MyTreeContext
(
TreeContext
):
def
format
(
self
):
if
not
self
.
show_lines
:
return
""
# output = "```\n"
output
=
""
dots
=
not
(
0
in
self
.
show_lines
)
for
i
,
line
in
enumerate
(
self
.
lines
):
if
i
not
in
self
.
show_lines
:
if
dots
:
output
+=
"
\n
...
\n\n
"
dots
=
False
continue
line_output
=
f
"
{
self
.
output_lines
.
get
(
i
,
line
)
}
"
output
+=
line_output
+
"
\n
"
dots
=
True
# output += "```\n"
return
output
class
RepoMap
:
class
RepoMap
:
CACHE_VERSION
=
3
CACHE_VERSION
=
3
TAGS_CACHE_DIR
=
f
"
.ecopilot.tags.cache.v
{
CACHE_VERSION
}
"
TAGS_CACHE_DIR
=
f
"
.ecopilot.tags.cache.v
{
CACHE_VERSION
}
"
...
@@ -634,7 +662,7 @@ class RepoMap:
...
@@ -634,7 +662,7 @@ class RepoMap:
if
not
code
.
endswith
(
"
\n
"
):
if
not
code
.
endswith
(
"
\n
"
):
code
+=
"
\n
"
code
+=
"
\n
"
context
=
TreeContext
(
context
=
My
TreeContext
(
rel_fname
,
rel_fname
,
code
,
code
,
color
=
False
,
color
=
False
,
...
@@ -691,7 +719,7 @@ class RepoMap:
...
@@ -691,7 +719,7 @@ class RepoMap:
lois
.
append
(
tag
.
line
)
lois
.
append
(
tag
.
line
)
# truncate long lines, in case we get minified js or something else crazy
# truncate long lines, in case we get minified js or something else crazy
output
=
"
\n
"
.
join
([
line
[:
1
0
0
]
for
line
in
output
.
splitlines
()])
+
"
\n
"
output
=
"
\n
"
.
join
([
line
[:
1
2
0
]
for
line
in
output
.
splitlines
()])
+
"
\n
"
return
output
return
output
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment