Don't try and open recent files for vscode
It's rarely needed, and it's now much harder to determine
This commit is contained in:
parent
308437cf54
commit
e3ae027b47
1 changed files with 1 additions and 17 deletions
|
@ -1,14 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import json
|
|
||||||
import itertools
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
HOME = Path.home()
|
HOME = Path.home()
|
||||||
|
|
||||||
VSCODE_CONFIG_FILE = HOME.joinpath(".config/Code/storage.json")
|
|
||||||
|
|
||||||
SEARCH_DIRS = [
|
SEARCH_DIRS = [
|
||||||
HOME.joinpath("Projects"),
|
HOME.joinpath("Projects"),
|
||||||
HOME.joinpath("Repositories"),
|
HOME.joinpath("Repositories"),
|
||||||
|
@ -25,20 +21,8 @@ def get_search_project_dirs():
|
||||||
yield subdir
|
yield subdir
|
||||||
|
|
||||||
|
|
||||||
def get_vscode_project_dirs():
|
|
||||||
vscode_config = json.loads(VSCODE_CONFIG_FILE.read_text())
|
|
||||||
|
|
||||||
for entry in vscode_config['openedPathsList']['entries']:
|
|
||||||
recent_path = entry.get('folderUri')
|
|
||||||
if not recent_path:
|
|
||||||
continue
|
|
||||||
recent_path_path = Path(recent_path.replace('file://', ''))
|
|
||||||
if recent_path_path.exists():
|
|
||||||
yield recent_path_path
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
project_paths = sorted(set(itertools.chain(get_search_project_dirs(), get_vscode_project_dirs())), key=lambda p: p.name.lower())
|
project_paths = sorted(get_search_project_dirs(), key=lambda p: p.name.lower())
|
||||||
try:
|
try:
|
||||||
project_paths.remove(Path.home()) # Don't try and edit home dir
|
project_paths.remove(Path.home()) # Don't try and edit home dir
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
Loading…
Reference in a new issue