Skip to content

Commit 91cc533

Browse files
committed
Add settings file and refactor import paths for examples
- Introduced a new settings.local.json file for permission configurations. - Updated import paths in demo.py, automated_workflow.py, basic_notify.py, editor_info.py, and text_replacement.py to reference the python_client module correctly. - Removed outdated sample.js and sample.py files.
1 parent 0120812 commit 91cc533

File tree

9 files changed

+25
-52
lines changed

9 files changed

+25
-52
lines changed

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(python:*)"
5+
],
6+
"deny": [],
7+
"ask": []
8+
}
9+
}

workspace/demo.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
import os
1616
import time
1717

18-
# Add the python_client directory to the path
19-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python_client'))
20-
21-
from vscode_bridge import VSCodeBridge, VSCodeBridgeError
18+
from python_client.vscode_bridge import VSCodeBridge, VSCodeBridgeError
2219

2320
def print_header(title: str):
2421
"""Print a formatted section header."""
@@ -132,7 +129,9 @@ def demo_text_reading(bridge: VSCodeBridge, editors: list):
132129
print(f"❌ Error reading text: {e}")
133130
return None
134131

135-
def demo_text_modification(bridge: VSCodeBridge, original_content: str):
132+
from typing import Optional
133+
134+
def demo_text_modification(bridge: VSCodeBridge, original_content: Optional[str]):
136135
"""Demo modifying text in the active editor."""
137136
print_header("4. TEXT MODIFICATION DEMO")
138137

837 Bytes
Binary file not shown.

workspace/examples/automated_workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import time
1212
import re
1313

14-
# Add the python_client directory to the path so we can import the bridge
15-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python_client'))
14+
# Add workspace root to Python path
15+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
1616

17-
from vscode_bridge import VSCodeBridge, VSCodeBridgeError
17+
from python_client.vscode_bridge import VSCodeBridge, VSCodeBridgeError
1818

1919
def analyze_file_content(filename: str, content: str) -> dict:
2020
"""Analyze file content and return statistics."""

workspace/examples/basic_notify.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import sys
1010
import os
1111

12-
# Add the python_client directory to the path so we can import the bridge
13-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python_client'))
12+
# Add workspace root to Python path
13+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
1414

15-
from vscode_bridge import VSCodeBridge, VSCodeBridgeError
15+
from python_client.vscode_bridge import VSCodeBridge, VSCodeBridgeError
1616

1717
def main():
1818
"""Send a simple notification to VS Code."""

workspace/examples/editor_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import sys
1010
import os
1111

12-
# Add the python_client directory to the path so we can import the bridge
13-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python_client'))
12+
# Add workspace root to Python path
13+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
1414

15-
from vscode_bridge import VSCodeBridge, VSCodeBridgeError
15+
from python_client.vscode_bridge import VSCodeBridge, VSCodeBridgeError
1616

1717
def main():
1818
"""Get and display information about all open editors."""

workspace/examples/text_replacement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import sys
1010
import os
1111

12-
# Add the python_client directory to the path so we can import the bridge
13-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'python_client'))
12+
# Add workspace root to Python path
13+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
1414

15-
from vscode_bridge import VSCodeBridge, VSCodeBridgeError
15+
from python_client.vscode_bridge import VSCodeBridge, VSCodeBridgeError
1616

1717
def main():
1818
"""Read text from an editor and modify the active editor."""

workspace/sample.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

workspace/sample.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)