snow-ai 0.2.21 → 0.2.22
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.
|
@@ -31,6 +31,12 @@ declare class VSCodeConnectionManager {
|
|
|
31
31
|
private listeners;
|
|
32
32
|
private currentWorkingDirectory;
|
|
33
33
|
start(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Normalize path for cross-platform compatibility
|
|
36
|
+
* - Converts Windows backslashes to forward slashes
|
|
37
|
+
* - Converts drive letters to lowercase for consistent comparison
|
|
38
|
+
*/
|
|
39
|
+
private normalizePath;
|
|
34
40
|
/**
|
|
35
41
|
* Find the correct port for the current workspace
|
|
36
42
|
*/
|
|
@@ -149,6 +149,19 @@ class VSCodeConnectionManager {
|
|
|
149
149
|
tryConnect(targetPort);
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Normalize path for cross-platform compatibility
|
|
154
|
+
* - Converts Windows backslashes to forward slashes
|
|
155
|
+
* - Converts drive letters to lowercase for consistent comparison
|
|
156
|
+
*/
|
|
157
|
+
normalizePath(filePath) {
|
|
158
|
+
let normalized = filePath.replace(/\\/g, '/');
|
|
159
|
+
// Convert Windows drive letter to lowercase (C: -> c:)
|
|
160
|
+
if (/^[A-Z]:/.test(normalized)) {
|
|
161
|
+
normalized = normalized.charAt(0).toLowerCase() + normalized.slice(1);
|
|
162
|
+
}
|
|
163
|
+
return normalized;
|
|
164
|
+
}
|
|
152
165
|
/**
|
|
153
166
|
* Find the correct port for the current workspace
|
|
154
167
|
*/
|
|
@@ -157,15 +170,16 @@ class VSCodeConnectionManager {
|
|
|
157
170
|
const portInfoPath = path.join(os.tmpdir(), 'snow-cli-ports.json');
|
|
158
171
|
if (fs.existsSync(portInfoPath)) {
|
|
159
172
|
const portInfo = JSON.parse(fs.readFileSync(portInfoPath, 'utf8'));
|
|
160
|
-
//
|
|
161
|
-
const cwd = this.currentWorkingDirectory;
|
|
173
|
+
// Normalize cwd for consistent comparison
|
|
174
|
+
const cwd = this.normalizePath(this.currentWorkingDirectory);
|
|
162
175
|
// Direct match
|
|
163
176
|
if (portInfo[cwd]) {
|
|
164
177
|
return portInfo[cwd];
|
|
165
178
|
}
|
|
166
179
|
// Check if cwd is within any of the workspace folders
|
|
167
180
|
for (const [workspace, port] of Object.entries(portInfo)) {
|
|
168
|
-
|
|
181
|
+
const normalizedWorkspace = this.normalizePath(workspace);
|
|
182
|
+
if (cwd.startsWith(normalizedWorkspace)) {
|
|
169
183
|
return port;
|
|
170
184
|
}
|
|
171
185
|
}
|
|
@@ -185,11 +199,12 @@ class VSCodeConnectionManager {
|
|
|
185
199
|
if (!data.workspaceFolder) {
|
|
186
200
|
return true;
|
|
187
201
|
}
|
|
188
|
-
//
|
|
189
|
-
const cwd = this.currentWorkingDirectory;
|
|
202
|
+
// Normalize paths for consistent comparison across platforms
|
|
203
|
+
const cwd = this.normalizePath(this.currentWorkingDirectory);
|
|
204
|
+
const workspaceFolder = this.normalizePath(data.workspaceFolder);
|
|
190
205
|
// Bidirectional check: either cwd is within IDE workspace, or IDE workspace is within cwd
|
|
191
|
-
const cwdInWorkspace = cwd.startsWith(
|
|
192
|
-
const workspaceInCwd =
|
|
206
|
+
const cwdInWorkspace = cwd.startsWith(workspaceFolder);
|
|
207
|
+
const workspaceInCwd = workspaceFolder.startsWith(cwd);
|
|
193
208
|
const matches = cwdInWorkspace || workspaceInCwd;
|
|
194
209
|
return matches;
|
|
195
210
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -57,10 +57,16 @@ $ npm uninstall --global snow-ai
|
|
|
57
57
|
|
|
58
58
|
## Install VSCode Extension
|
|
59
59
|
|
|
60
|
-
* download [VSIX/snow-cli-
|
|
60
|
+
* download [VSIX/snow-cli-x.x.x.vsix](https://github.com/MayDay-wpf/snow-cli/blob/main/VSIX/)
|
|
61
61
|
|
|
62
62
|
* open VSCode, click `Extensions` -> `Install from VSIX...` -> select `snow-cli-0.2.6.vsix`
|
|
63
63
|
|
|
64
|
+
## Install JetBrains plugin
|
|
65
|
+
|
|
66
|
+
* download [JetBrains/build/distributions](https://github.com/MayDay-wpf/snow-cli/tree/main/JetBrains/build/distributions)
|
|
67
|
+
|
|
68
|
+
* File > Settings > Plugins
|
|
69
|
+
|
|
64
70
|
## Live View
|
|
65
71
|
* **Welcome & Settings**
|
|
66
72
|
|