Skip to content

Commit 06caf9f

Browse files
authored
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
1 parent 9c2077f commit 06caf9f

File tree

4 files changed

+126
-0
lines changed

4 files changed

+126
-0
lines changed

Diff for: .vscode/extensions.json

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

Diff for: .vscode/launch.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build-and-copy",
12+
"program": "${config:jellyfinDir}/bin/Debug/net6.0/jellyfin.dll",
13+
"args": [
14+
//"--nowebclient"
15+
"--webdir",
16+
"${config:jellyfinWebDir}/dist/"
17+
],
18+
"cwd": "${config:jellyfinDir}",
19+
"console": "internalConsole",
20+
"stopAtEntry": false,
21+
"internalConsoleOptions": "openOnSessionStart",
22+
"serverReadyAction": {
23+
"action": "openExternally",
24+
"pattern": "Overriding address\\(es\\) \\'(https?:\\S+)\\'",
25+
},
26+
}
27+
]
28+
}

Diff for: .vscode/settings.json

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

Diff for: .vscode/tasks.json

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build-and-copy",
8+
"dependsOrder": "sequence",
9+
"dependsOn": [
10+
"build",
11+
"make-plugin-dir",
12+
"copy-dll",
13+
],
14+
},
15+
{
16+
"label": "build",
17+
"command": "dotnet",
18+
"type": "shell",
19+
"args": [
20+
"publish",
21+
"${workspaceFolder}/${config:pluginName}.sln",
22+
"/property:GenerateFullPaths=true",
23+
"/consoleloggerparameters:NoSummary"
24+
],
25+
"group": "build",
26+
"presentation": {
27+
"reveal": "silent"
28+
},
29+
"problemMatcher": "$msCompile"
30+
},
31+
{
32+
"label": "make-plugin-dir",
33+
"type": "shell",
34+
"command": "mkdir",
35+
"windows": {
36+
"args": [
37+
"-Force",
38+
"-Path",
39+
"${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/"
40+
]
41+
},
42+
"linux": {
43+
"args": [
44+
"-p",
45+
"${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/"
46+
]
47+
}
48+
},
49+
{
50+
"label": "copy-dll",
51+
"type": "shell",
52+
"command": "cp",
53+
"windows": {
54+
"args": [
55+
"./${config:pluginName}/bin/Debug/net6.0/publish/*",
56+
"${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/"
57+
]
58+
},
59+
"linux": {
60+
"args": [
61+
"-r",
62+
"./${config:pluginName}/bin/Debug/net6.0/publish/*",
63+
"${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/"
64+
]
65+
}
66+
}
67+
]
68+
}

0 commit comments

Comments
 (0)