setta 0.0.3.dev5__py3-none-any.whl → 0.0.3.dev6__py3-none-any.whl
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.
- setta/__init__.py +1 -1
- setta/lsp/file_watcher.py +24 -23
- setta/lsp/server.py +1 -1
- setta/lsp/writer.py +2 -2
- {setta-0.0.3.dev5.dist-info → setta-0.0.3.dev6.dist-info}/METADATA +1 -1
- {setta-0.0.3.dev5.dist-info → setta-0.0.3.dev6.dist-info}/RECORD +10 -10
- {setta-0.0.3.dev5.dist-info → setta-0.0.3.dev6.dist-info}/LICENSE +0 -0
- {setta-0.0.3.dev5.dist-info → setta-0.0.3.dev6.dist-info}/WHEEL +0 -0
- {setta-0.0.3.dev5.dist-info → setta-0.0.3.dev6.dist-info}/entry_points.txt +0 -0
- {setta-0.0.3.dev5.dist-info → setta-0.0.3.dev6.dist-info}/top_level.txt +0 -0
setta/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.0.3.
|
1
|
+
__version__ = "0.0.3.dev6"
|
setta/lsp/file_watcher.py
CHANGED
@@ -75,17 +75,34 @@ class LSPEventHandler(FileSystemEventHandler):
|
|
75
75
|
self.callback = callback
|
76
76
|
self.loop = loop
|
77
77
|
|
78
|
-
def
|
78
|
+
def on_created(self, event: FileSystemEvent):
|
79
79
|
if event.is_directory:
|
80
80
|
return
|
81
|
+
changes = [{"uri": self._path_to_uri(event.src_path), "type": 1}]
|
82
|
+
self._send_changes(changes)
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
def on_modified(self, event: FileSystemEvent):
|
85
|
+
if event.is_directory:
|
86
|
+
return
|
87
|
+
changes = [{"uri": self._path_to_uri(event.src_path), "type": 2}]
|
88
|
+
self._send_changes(changes)
|
89
|
+
|
90
|
+
def on_deleted(self, event: FileSystemEvent):
|
91
|
+
if event.is_directory:
|
92
|
+
return
|
93
|
+
changes = [{"uri": self._path_to_uri(event.src_path), "type": 3}]
|
94
|
+
self._send_changes(changes)
|
88
95
|
|
96
|
+
def on_moved(self, event: FileSystemEvent):
|
97
|
+
if event.is_directory:
|
98
|
+
return
|
99
|
+
# Treat move as deletion of the old path and creation of the new path.
|
100
|
+
changes_del = [{"uri": self._path_to_uri(event.src_path), "type": 3}]
|
101
|
+
changes_cre = [{"uri": self._path_to_uri(event.dest_path), "type": 1}]
|
102
|
+
self._send_changes(changes_del)
|
103
|
+
self._send_changes(changes_cre)
|
104
|
+
|
105
|
+
def _send_changes(self, changes):
|
89
106
|
if asyncio.iscoroutinefunction(self.callback):
|
90
107
|
self.loop.call_soon_threadsafe(
|
91
108
|
lambda: self.loop.create_task(self.callback(changes))
|
@@ -94,20 +111,4 @@ class LSPEventHandler(FileSystemEventHandler):
|
|
94
111
|
self.callback(changes)
|
95
112
|
|
96
113
|
def _path_to_uri(self, path: str) -> str:
|
97
|
-
"""Convert file path to URI format."""
|
98
114
|
return Path(path).as_uri()
|
99
|
-
|
100
|
-
def _get_change_type(self, event: FileSystemEvent) -> int:
|
101
|
-
"""
|
102
|
-
Convert watchdog event type to LSP change type.
|
103
|
-
1: Created
|
104
|
-
2: Changed
|
105
|
-
3: Deleted
|
106
|
-
"""
|
107
|
-
if event.event_type == "created":
|
108
|
-
return 1
|
109
|
-
elif event.event_type == "modified":
|
110
|
-
return 2
|
111
|
-
elif event.event_type == "deleted":
|
112
|
-
return 3
|
113
|
-
return 2 # Default to changed
|
setta/lsp/server.py
CHANGED
setta/lsp/writer.py
CHANGED
@@ -268,7 +268,7 @@ class LanguageServerWriter(LanguageServerInteractor):
|
|
268
268
|
asyncio.create_task(async_task)
|
269
269
|
|
270
270
|
def get_workspace_uri(self):
|
271
|
-
return f"file://{self.workspace_folder}"
|
271
|
+
return f"file://{self.workspace_folder}"
|
272
272
|
|
273
273
|
def get_base_uri(self, code_id):
|
274
274
|
return self.code_folder / f"{code_id}.py"
|
@@ -277,7 +277,7 @@ class LanguageServerWriter(LanguageServerInteractor):
|
|
277
277
|
def get_uri(self, code_id, virtual):
|
278
278
|
base_uri = self.get_base_uri(code_id)
|
279
279
|
prefix = "untitled:" if virtual else "file://"
|
280
|
-
uri = f"{prefix}{base_uri}"
|
280
|
+
uri = f"{prefix}{base_uri}"
|
281
281
|
if platform.system() == "Windows":
|
282
282
|
uri += "/" # need trailing slash on Windows for some reason
|
283
283
|
return uri
|
@@ -1,4 +1,4 @@
|
|
1
|
-
setta/__init__.py,sha256=
|
1
|
+
setta/__init__.py,sha256=JOqhw8-CqggriXVSQQAoRFGiunAaahoVCICD55JZU80,27
|
2
2
|
setta/server.py,sha256=P78BMFvcCokVhjnVlNIKcmpCSvmzSqt-33bx4bhOe6Y,4626
|
3
3
|
setta/start.py,sha256=jEeSiocLeBitvg48fa6k1CpLnPI63JHkQ8O-WVM6ch8,3078
|
4
4
|
setta/cli/__init__.py,sha256=UxZG_VOMuF6lEBT3teUgTS9ulsK3wt3Gu3BbAQiAmt8,47
|
@@ -70,11 +70,11 @@ setta/database/export_db/export_raw.py,sha256=exRPZXOzPXUgZhcG6d4zolOOnsWuV25TtZ
|
|
70
70
|
setta/database/export_db/export_readable.py,sha256=V4XAfOSnSSnR7ywwNKfOItIGcbyNKEtuSZzBhp5-ivo,8665
|
71
71
|
setta/database/export_db/utils.py,sha256=wJBkZUEjMsf_Qu4tRZYeU-CRujsuoWSzMmQZsje8LU8,495
|
72
72
|
setta/lsp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
73
|
-
setta/lsp/file_watcher.py,sha256=
|
73
|
+
setta/lsp/file_watcher.py,sha256=9g1x9XUkCNsV4JQXbYGm9xAFMNXXJcYBs-vBnp_RS8g,3661
|
74
74
|
setta/lsp/reader.py,sha256=MD7pJfsTKUGwDarzmig6s8GvrIcRerr_OweO28EZS0s,7123
|
75
|
-
setta/lsp/server.py,sha256=
|
75
|
+
setta/lsp/server.py,sha256=jgPTsei2-ZbIFm1oP3OwBUjqmKc-rl2NUz1c0aY0EgM,4480
|
76
76
|
setta/lsp/utils.py,sha256=H0y2HaU9i6mliKYjsieb556Il0p0ynmjxQV7FnZ9cqo,1648
|
77
|
-
setta/lsp/writer.py,sha256=
|
77
|
+
setta/lsp/writer.py,sha256=uNjUpqB6zESvjtVPp0rhVXhoWOLNLVN-TIJ0-B-zUQU,10391
|
78
78
|
setta/lsp/reader_fns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
79
79
|
setta/lsp/reader_fns/completion.py,sha256=aozup-q0B0hWdNERZdsu_7dHYl0Ec8_hwfGczMiqXVA,2312
|
80
80
|
setta/lsp/reader_fns/definition.py,sha256=NDnRQGj-HrRCo0fMtEfbsQr2koWK-G45K2zoSfIkTN0,79
|
@@ -254,9 +254,9 @@ setta/utils/generate_new_filename.py,sha256=KBLX6paDmTvXR-027TpqQkfijIXc7mCfhen-
|
|
254
254
|
setta/utils/section_contents.py,sha256=V2HQPik6DfSXw4j7IalbP5AZ3OEGCbtL5ub3xL-Q_Qo,4141
|
255
255
|
setta/utils/utils.py,sha256=KjzcvgM3Ab3IcE8vaWYtgBpwzPLKg0LmblnHLoYZJHM,9164
|
256
256
|
setta/utils/websocket_manager.py,sha256=S2lEGZsc2OhW0yKLW9VEcH7wi7ppzTfDMQa_hxf3ovc,3772
|
257
|
-
setta-0.0.3.
|
258
|
-
setta-0.0.3.
|
259
|
-
setta-0.0.3.
|
260
|
-
setta-0.0.3.
|
261
|
-
setta-0.0.3.
|
262
|
-
setta-0.0.3.
|
257
|
+
setta-0.0.3.dev6.dist-info/LICENSE,sha256=us9fuCq9wmiZVzayjKxNZ2iJYF6dROe0Qp57ToCO7XU,11361
|
258
|
+
setta-0.0.3.dev6.dist-info/METADATA,sha256=xTOThn0QFQy5IPwzDJrqx-p05RTKZgFoGl8EQjd_tY8,829
|
259
|
+
setta-0.0.3.dev6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
260
|
+
setta-0.0.3.dev6.dist-info/entry_points.txt,sha256=P0qCESy9fWF2q1EQ9JufGldCSnPHplDPn8J6Bgk5hB0,42
|
261
|
+
setta-0.0.3.dev6.dist-info/top_level.txt,sha256=8G4lmRzVOnJ11_DescPVHE6MQZH-o06A0nGsDDV2ngY,6
|
262
|
+
setta-0.0.3.dev6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|