Conversation
This will change how extension packs are named in the data extensions editor. Before, the user had to pick a workspace folder and a name for the extension pack. Now, the workspace folder will be picked automatically if we can detect it (i.e. it follows the naming structure we expect), or the user will still need to select it. The extension pack name is always auto-generated based on the database name and the database language. This adds a new `codeQL.dataExtensions.disableAutoNameExtensionPack` setting to disable this behavior while we are still working on changing how the data extensions editor works.
928fed1 to
5d83ac8
Compare
starcke
left a comment
There was a problem hiding this comment.
Looks pretty good, just some smaller comments.
It felt a bit to odd to me that we just created the pack file but asked about the model file name. I would personally have expected the opposite. Later we do want the yml file to be based on the library name, so I am fine with it like this if that is easier.
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
koesie10
left a comment
There was a problem hiding this comment.
It felt a bit to odd to me that we just created the pack file but asked about the model file name. I would personally have expected the opposite. Later we do want the yml file to be based on the library name, so I am fine with it like this if that is easier.
They are essentially independent, so I've done only the extension pack name in this PR to keep the sizes of the PRs manageable. The model file name is in #2521. That means that for now the flow is a bit strange, but it helps to keep the changes minimal.
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts
Outdated
Show resolved
Hide resolved
extensions/ql-vscode/test/unit-tests/data-extensions-editor/extension-pack-name.test.ts
Show resolved
Hide resolved
a0820d7 to
cfc66a4
Compare
| return Uri.joinPath(workspaceFile, ".."); | ||
| } | ||
|
|
||
| const workspaceFolders = getOnDiskWorkspaceFoldersObjects(); |
There was a problem hiding this comment.
Does getOnDiskWorkspaceFoldersObjects return only file: URIs? If not, you will need to filter out the all the other ones.
There was a problem hiding this comment.
Yes, that's exactly what getOnDiskWorkspaceFoldersObjects does, so this should only return workspace folders which actually exist on-disk.
| // The path closest to the workspace folders is the last element of the common root | ||
| const commonRootUri = commonRoot[commonRoot.length - 1]; | ||
|
|
||
| // If we are at the root of the filesystem, we can't go up any further and there's something |
There was a problem hiding this comment.
This will be reasonably common in codeql projets. There's a quick-query command that creates a temp folder and adds it to the workspace. Any workspace that has a quick query folder will only have a common root at /.
Perhaps you will want to filter folders in the temp directory?
There was a problem hiding this comment.
Also, maybe look for a .git folder?
There was a problem hiding this comment.
I've added both filtering out temp directories and looking for the .git folder. If it can't find a common ancestor, it will now try to find the .git folder closest to one of the workspace folders and pick that.
aeisenberg
left a comment
There was a problem hiding this comment.
Nice.
Not necessary for this PR, but the heuristic for choosing a location for extension packs is quite complicated. It would be good to see it documented somewhere. (Either in code as comments, or in a separate document.)
This will change how extension packs are named in the data extensions editor. Before, the user had to pick a workspace folder and a name for the extension pack. Now, the workspace folder will be picked automatically if we can detect it (i.e. it follows the naming structure we expect), or the user will still need to select it. The extension pack name is always auto-generated based on the database name and the database language.
This adds a new
codeQL.dataExtensions.disableAutoNameExtensionPacksetting to disable this behavior while we are still working on changing how the data extensions editor works.Checklist
ready-for-doc-reviewlabel there.