Skip to content

Commit 981716c

Browse files
committed
Switch to explorer treeview and name to Spec
1 parent f8930cd commit 981716c

File tree

7 files changed

+26
-31
lines changed

7 files changed

+26
-31
lines changed

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"typescript.surveys.enabled": false,
3+
"python.pythonPath": "C:\\Users\\lannl\\AppData\\Local\\Programs\\Python\\Python38\\python.exe"
4+
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Change Log
2-
All notable changes to the "audio" extension will be documented in this file.
2+
All notable changes to the "spec" extension will be documented in this file.
33

44
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
55

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# audio README
1+
# spec README
22

3-
This is the README for your extension "audio". After writing up a brief description, we recommend including the following sections.
3+
This is the README for your extension "spec". After writing up a brief description, we recommend including the following sections.
44

55
## Features
66

package.json

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "audio",
3-
"displayName": "audio",
2+
"name": "spec",
3+
"displayName": "spec",
44
"description": "description",
55
"version": "0.0.1",
66
"engines": {
@@ -14,20 +14,11 @@
1414
],
1515
"main": "src/extension.js",
1616
"contributes": {
17-
"viewsContainers": {
18-
"activitybar": [
19-
{
20-
"id": "audio-explorer",
21-
"title": "audio Explorer",
22-
"icon": "media/dep.svg"
23-
}
24-
]
25-
},
2617
"views": {
27-
"audio-explorer": [
18+
"explorer": [
2819
{
29-
"id": "audios",
30-
"name": "audios"
20+
"id": "spec",
21+
"name": "Spec Explorer"
3122
}
3223
]
3324
}

src/extension.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ function activate(context) {
1414
vscode.window.showInformationMessage('Hello World!')
1515
// let files = vscode.workspace.findFiles('**/*', null, 100)
1616
// files.then(data => console.log(data), error => console.error(error))
17-
18-
const test = new tv.Treeview
1917

20-
test.audiosViewer.onDidChangeSelection(file => {
18+
const test = new tv.Treeview(context)
19+
20+
test.specViewer.onDidChangeSelection(file => {
2121
console.log(file)
22-
console.log(test.audiosViewer.selection)
22+
console.log(test.specViewer.selection)
2323
})
2424

25-
25+
2626
// vscode.workspace.onDidChangeConfiguration()
2727

2828
const compiledFunction = pug.compileFile(`${__dirname}\\index.pug`)

src/index.pug

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
html
22
head
3-
title Audio
3+
title Spec
44
meta(charset='UTF-8')
55
meta(http-equiv='Content-Security-Policy',
6-
content=`default-src 'none'; img-src vscode-resource: https:; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}' https:; font-src data: vscode-resource: https:; worker-src blob:; connect-src vscode-resource:`)
6+
content=`default-src 'none'; img-src vscode-resource: https:; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}' https:; font-src data: vscode-resource: https:; worker-src blob:; connect-src vscode-resource: ws:`)
77
meta(name='viewport', content='width=device-width, initial-scale=1.0')
88
script(nonce=`${nonce}`).
99
rootPath = '#{song_path}'

src/treeview.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ const fs = require('fs')
66

77
class Treeview {
88
constructor(context) {
9-
const treeDataProvider = new AudioTreeDataProvider(
9+
const treeDataProvider = new SpecTreeDataProvider(
1010
vscode.workspace.rootPath
1111
)
12-
this.audiosViewer = vscode.window.createTreeView('audios', {
13-
treeDataProvider
14-
})
12+
context.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider('spec', treeDataProvider));
13+
this.specViewer = vscode.window.createTreeView('spec', { treeDataProvider });
14+
1515
}
1616
}
1717

18-
class AudioTreeDataProvider {
18+
class SpecTreeDataProvider {
1919
constructor(workspaceRoot) {
2020
this.workspaceRoot = workspaceRoot
2121
this._onDidChangeTreeData = new vscode.EventEmitter()
@@ -38,7 +38,7 @@ class AudioTreeDataProvider {
3838

3939
if (element) {
4040
return this.getFiles(path.join(element.filePath, element.label))
41-
41+
4242
} else {
4343
return this.getFiles(this.workspaceRoot)
4444
}
@@ -53,7 +53,7 @@ class AudioTreeDataProvider {
5353
collapsibleState = vscode.TreeItemCollapsibleState.Collapsed
5454
descriptionText = `${filesCount} song`
5555
if(filesCount > 1) descriptionText += 's'
56-
56+
5757
} else {
5858
collapsibleState = vscode.TreeItemCollapsibleState.None
5959
descriptionText = 'Empty'

0 commit comments

Comments
 (0)