You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,18 @@ Adds a button to the Sourcegraph's extension panel and at the top of files in co
4
4
5
5
## Settings
6
6
7
-
**This extension requires all git repos to be already cloned under the base path with their original names.**
7
+
****This extension requires all git repos to be cloned and available on your local machine.**
8
8
9
9
- Add `openineditor.editor` to your user settings to open files in the editor. Copy one of the following lines depending on the editor you would like to use. This extension only supports opening in one editor at a time. Supported editors:
10
10
-`vscode` (Visual Studio Code): `"openineditor.editor": "vscode"`
-`sublime` (Sublime Text, requires a URL handler installed such as [this one for macOS](https://github.com/inopinatus/sublime_url))
13
13
-`custom` (requires also setting `openineditor.customUrlPattern`): `"openineditor.editor": "custom"`
14
+
14
15
-`openineditor.basePath`: The absolute path on your computer where your git repositories live. This extension requires all git repos to be already cloned under this path with their original names. `"/Users/yourusername/src"` is a valid absolute path, while `"~/src"` is not.
16
+
15
17
-`openineditor.customUrlPattern`: If you set `openineditor.editor` to `custom`, this must be set. Use placeholders `%file`, `%line`, and `%col` to mark where the file path, line number, and column number must be replaced. Example URL for IntelliJ IDEA: `idea://open?file=%file&line=%line&column=%col`
18
+
16
19
-`openineditor.replacements`: Takes object, where each key is replaced by value in the final url. The key can be a string or a RegExp, and the value must be a string. For example, `"openineditor.replacements": {"(?<=Documents\/)(.*[\\\/])": "sourcegraph-$1"},` will add `sourcegraph-` in front of the string that matches the `(?<=Documents\/)(.*[\\\/])` RegExp pattern, which is the string after `Documents/` and before the final slash: `vscode://file//Users/USERNAME/Documents/REPO-NAME/package.json` => `vscode://file//Users/USERNAME/Documents/sourcegraph-REPO-NAME/package.json`
17
20
18
21
## Examples
@@ -110,6 +113,26 @@ To open repository files in your Documents directory:
110
113
}
111
114
```
112
115
116
+
### VS Code with different base paths configured for different platforms
117
+
118
+
Uses the assigned path for the detected Operating System when available:
119
+
120
+
```json
121
+
{
122
+
"extensions": {
123
+
"sourcegraph/open-in-editor": true
124
+
},
125
+
"openineditor.osPaths": {
126
+
"windows": "/C:/Users/USERNAME/folder/",
127
+
"mac": "/Users/USERNAME/folder/",
128
+
"linux": "/home/USERNAME/folder/"
129
+
},
130
+
"openineditor.editor" : "vscode",
131
+
// basePath is required as the default path when no Operating System is detected
### Replacement Example 1: Open Remote folders with VS Code on Mac by removing file names
114
137
115
138
**This requires VS Code extension [Remote Development by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) to work.**
Copy file name to clipboardExpand all lines: package.json
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,14 @@
64
64
"openineditor.basePath": {
65
65
"description": "The file path on the machine to the folder that is expected to contain all repositories.",
66
66
"type": "string"
67
+
},
68
+
"openineditor.osPaths": {
69
+
"description": "The file path on each platform to the folder that is expected to contain all repositories.",
70
+
"type": "object"
71
+
},
72
+
"openineditor.replacements": {
73
+
"description": "Take key-value pairs where each key is replaced by its value in the final url. The key can be a string or a RegExp pattern, and the value must be a string. The final path must be a valid path on the machine to the folder that is expected to contain all repositories.",
0 commit comments