mirror of
https://github.com/j1g5awi/krunner-vscode.git
synced 2024-11-24 05:09:30 +00:00
✨ Get path list each time
This commit is contained in:
parent
2b5926ee04
commit
7c6bc0c063
1 changed files with 16 additions and 16 deletions
|
@ -27,22 +27,22 @@ class Match(NamedTuple):
|
||||||
# TODO Check VSCode or Code - OSS or VSCodium
|
# TODO Check VSCode or Code - OSS or VSCodium
|
||||||
|
|
||||||
# Read path_list from database
|
# Read path_list from database
|
||||||
con = sqlite3.connect(
|
def get_path_list():
|
||||||
|
con = sqlite3.connect(
|
||||||
os.path.join(
|
os.path.join(
|
||||||
os.environ["HOME"], ".config", "Code - OSS/User/globalStorage/state.vscdb"
|
os.environ["HOME"], ".config", "Code - OSS/User/globalStorage/state.vscdb"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
rows = cur.execute(
|
rows = cur.execute(
|
||||||
"SELECT value FROM ItemTable WHERE key = 'history.recentlyOpenedPathsList'"
|
"SELECT value FROM ItemTable WHERE key = 'history.recentlyOpenedPathsList'"
|
||||||
)
|
)
|
||||||
data = json.loads(rows.fetchone()[0])
|
data = json.loads(rows.fetchone()[0])
|
||||||
con.close()
|
con.close()
|
||||||
path_list = [
|
return [
|
||||||
"~" + path[len(os.environ["HOME"]) :]
|
"~" + path[len(os.environ["HOME"]) :] if os.environ["HOME"] in path else path
|
||||||
for path in [i["folderUri"][7:] for i in data["entries"] if "folderUri" in i]
|
for path in [i["folderUri"][7:] for i in data["entries"] if "folderUri" in i]
|
||||||
if os.environ["HOME"] in path
|
]
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class Runner(dbus.service.Object):
|
class Runner(dbus.service.Object):
|
||||||
|
@ -67,7 +67,7 @@ class Runner(dbus.service.Object):
|
||||||
1.0,
|
1.0,
|
||||||
{"subtext": path},
|
{"subtext": path},
|
||||||
)
|
)
|
||||||
for path in path_list
|
for path in get_path_list()
|
||||||
if query in path
|
if query in path
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue