Add development setup for Visual Studio Code (#64)

* Add development setup for Visual Studio Code

The implementation of the development setup is based upon the
implementation in the plugin template repository with addition of proper
linux support.

The ${env:XDG_DATA_HOME} variable is not used, as this variable resolves
to the current working directory within Visual Studio Code's development
container. By manually specifying the file path, it is possible to use
Visual Studio Code's development container.

The "mkdir" command uses the "-p" flag. This flag creates the parent
directories, as well. Should they already exists, the command moves
down to the next folder to create without throwing an error.

The "-r" parameter of the "cp" is required to recursively copy all
files and directories within the "publish" directory.

* Add required extensions to Visual Studio Code
This commit is contained in:
Patrick 2022-08-07 14:35:19 +02:00 committed by GitHub
parent 9c2077f780
commit 06caf9fdb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 126 additions and 0 deletions

11
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"ms-dotnettools.csharp",
"editorconfig.editorconfig"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}

28
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-and-copy",
"program": "${config:jellyfinDir}/bin/Debug/net6.0/jellyfin.dll",
"args": [
//"--nowebclient"
"--webdir",
"${config:jellyfinWebDir}/dist/"
],
"cwd": "${config:jellyfinDir}",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"serverReadyAction": {
"action": "openExternally",
"pattern": "Overriding address\\(es\\) \\'(https?:\\S+)\\'",
},
}
]
}

19
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
// jellyfinDir : The directory of the cloned jellyfin server project
// This needs to be built once before it can be used
"jellyfinDir": "${workspaceFolder}/../jellyfin/Jellyfin.Server",
// jellyfinWebDir : The directory of the cloned jellyfin-web project
// This needs to be built once before it can be used
"jellyfinWebDir": "${workspaceFolder}/../jellyfin-web",
// jellyfinDataDir : the root data directory for a running jellyfin instance
// This is where jellyfin stores its configs, plugins, metadata etc
// This is platform specific by default, but on Windows defaults to
// ${env:LOCALAPPDATA}/jellyfin
// and on Linux, it defaults to
// ${env:XDG_DATA_HOME}/jellyfin
// However ${env:XDG_DATA_HOME} does not work in Visual Studio Code's development container!
"jellyfinWindowsDataDir": "${env:LOCALAPPDATA}/jellyfin",
"jellyfinLinuxDataDir": "$HOME/.local/share/jellyfin",
// The name of the plugin
"pluginName": "Jellyfin.Plugin.Bookshelf",
}

68
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,68 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build-and-copy",
"dependsOrder": "sequence",
"dependsOn": [
"build",
"make-plugin-dir",
"copy-dll",
],
},
{
"label": "build",
"command": "dotnet",
"type": "shell",
"args": [
"publish",
"${workspaceFolder}/${config:pluginName}.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
"label": "make-plugin-dir",
"type": "shell",
"command": "mkdir",
"windows": {
"args": [
"-Force",
"-Path",
"${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/"
]
},
"linux": {
"args": [
"-p",
"${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/"
]
}
},
{
"label": "copy-dll",
"type": "shell",
"command": "cp",
"windows": {
"args": [
"./${config:pluginName}/bin/Debug/net6.0/publish/*",
"${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/"
]
},
"linux": {
"args": [
"-r",
"./${config:pluginName}/bin/Debug/net6.0/publish/*",
"${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/"
]
}
}
]
}