Skip to content

Commit

Permalink
✨ Add Workspace support introduced in Code 1.18. Fixes #29 (#40)
Browse files Browse the repository at this point in the history
* 🔧 Move to vscode 1.18 and add scope to settings

* ✨ Read settings based on document URI

* ✨ Move away from workspace.rootPath

* 🐛 Update settings after workspace picker

* 🔧 Disable prettier on JSON to changes on every npm install

* Read settings based on current URI.
Use Uri.fsPath instead of Uri.path in order to work properly on Windows.

* Fixed typing errors

* 🔥 Remove deprectated command
  • Loading branch information
dkundel authored Nov 12, 2017
1 parent 3abdb5c commit 0ba5ceb
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 194 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
},

"prettier.trailingComma": "es5",
"prettier.singleQuote": true
"prettier.singleQuote": true,
"prettier.jsonEnable": []
}
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

294 changes: 151 additions & 143 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,150 +1,158 @@
{
"name": "vscode-new-file",
"displayName": "Advanced New File",
"description": "An easier way of creating a new file inside a project.",
"version": "3.2.2",
"icon": "images/logo-300x.png",
"galleryBanner": {
"color": "#eeeeee",
"theme": "light"
},
"license": "MIT",
"publisher": "dkundel",
"engines": {
"vscode": "^1.12.0"
"name": "vscode-new-file",
"displayName": "Advanced New File",
"description": "An easier way of creating a new file inside a project.",
"version": "3.2.2",
"icon": "images/logo-300x.png",
"galleryBanner": {
"color": "#eeeeee",
"theme": "light"
},
"license": "MIT",
"publisher": "dkundel",
"engines": {
"vscode": "^1.18.0"
},
"categories": [
"Other"
],
"bugs": {
"url": "https://github.com/dkundel/vscode-new-file/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/dkundel/vscode-new-file.git"
},
"activationEvents": [
"onCommand:newFile.createFromExplorer",
"onCommand:newFile.createNewFile"
],
"main": "./out/src/extension",
"contributes": {
"configuration": {
"title": "New File Extension Configuration",
"type": "object",
"properties": {
"newFile.showPathRelativeTo": {
"type": "string",
"enum": [
"root",
"project",
"none"
],
"default": "root",
"description": "Lets you configure what the path should be shown relative to. 'root' is the equivalent of showing the whole URL based on the configured root.",
"scope": "resource"
},
"newFile.relativeTo": {
"type": "string",
"enum": [
"file",
"project",
"root"
],
"default": "file",
"description": "Whether the entered path should be treated relative to the existing 'project', the currently selected 'file' or specified 'root'. If set to 'root' you need to set the 'rootDirectory' setting.",
"scope": "resource"
},
"newFile.rootDirectory": {
"type": "string",
"default": "~",
"description": "Only used when 'relativeTo' is set to 'root'. Used as the root for creating new files.",
"scope": "resource"
},
"newFile.defaultFileExtension": {
"type": "string",
"default": ".ts",
"description": "Default file extension to be used when no file is open.",
"scope": "resource"
},
"newFile.defaultBaseFileName": {
"type": "string",
"default": "newFile",
"description": "Default base file name.",
"scope": "resource"
},
"newFile.expandBraces": {
"type": "boolean",
"default": false,
"description": "Whether braces should be expanded to multiple paths (such as {test1,test2}.js creating two files, test1.js and test2.js",
"scope": "resource"
},
"newFile.fileTemplates": {
"type": "object",
"default": {},
"description": "Object of mappings from file extension to path for template file. The paths can be relative to the 'rootDirectory' or absolute paths.",
"scope": "resource"
},
"newFile.useFileTemplates": {
"type": "boolean",
"default": true,
"description": "If enabled it will look up template files in newFile.fileTemplates for file creation.",
"scope": "resource"
}
}
},
"categories": [
"Other"
"commands": [
{
"command": "newFile.createNewFile",
"title": "Files: Advanced New File"
},
{
"command": "newFile.createFromExplorer",
"title": "Advanced New File"
}
],
"bugs": {
"url": "https://github.com/dkundel/vscode-new-file/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/dkundel/vscode-new-file.git"
},
"activationEvents": [
"onCommand:newFile.createFromExplorer",
"onCommand:newFile.createNewFile"
"keybindings": [
{
"command": "newFile.createNewFile",
"key": "alt+ctrl+n",
"mac": "alt+cmd+n"
}
],
"main": "./out/src/extension",
"contributes": {
"configuration": {
"title": "New File Extension Configuration",
"type": "object",
"properties": {
"newFile.showPathRelativeTo": {
"type": "string",
"enum": [
"root",
"project",
"none"
],
"default": "root",
"description": "Let's you configure relative to what the path should be shown. 'root' is the equivalent of showing the whole URL base don the configured root."
},
"newFile.relativeTo": {
"type": "string",
"enum": [
"file",
"project",
"root"
],
"default": "file",
"description": "Whether the entered path should be treated relative to the existing 'project', the currently selected 'file' or specified 'root'. If set to 'root' you need to set the 'rootDirectory' setting."
},
"newFile.rootDirectory": {
"type": "string",
"default": "~",
"description": "Only used when 'relativeTo' is set to 'root'. Used as the root for creating new files."
},
"newFile.defaultFileExtension": {
"type": "string",
"default": ".ts",
"description": "Default file extension to be used when no file is open."
},
"newFile.defaultBaseFileName": {
"type": "string",
"default": "newFile",
"description": "Default base file name."
},
"newFile.expandBraces": {
"type": "boolean",
"default": false,
"description": "Whether braces should be expanded to multiple paths (such as {test1,test2}.js creating two files, test1.js and test2.js"
},
"newFile.fileTemplates": {
"type": "object",
"default": {},
"description": "Object of mappings from file extension to path for template file. The paths can be relative to the 'rootDirectory' or absolute paths."
},
"newFile.useFileTemplates": {
"type": "boolean",
"default": true,
"description": "If enabled it will look up template files in newFile.fileTemplates for file creation."
}
}
},
"commands": [
{
"command": "newFile.createNewFile",
"title": "Files: Advanced New File"
},
{
"command": "newFile.createFromExplorer",
"title": "Advanced New File"
}
],
"keybindings": [
{
"command": "newFile.createNewFile",
"key": "alt+ctrl+n",
"mac": "alt+cmd+n"
}
],
"menus": {
"explorer/context": [
{
"command": "newFile.createFromExplorer"
}
]
"menus": {
"explorer/context": [
{
"command": "newFile.createFromExplorer"
}
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"pretest": "npm run lint",
"test": "node ./node_modules/vscode/bin/test",
"lint": "tslint src/**/*.ts",
"lint:fix": "npm run lint -- --fix",
"contrib:add": "all-contributors add",
"contrib:generate": "all-contributors generate"
},
"devDependencies": {
"@types/expect.js": "^0.3.29",
"@types/mocha": "^2.2.41",
"@types/mockery": "^1.4.29",
"@types/node": "^7.0.18",
"@types/rimraf": "^0.0.28",
"all-contributors-cli": "^4.5.1",
"mocha": "^3.4.1",
"mockery": "^1.4.0",
"prettier": "^1.7.4",
"rimraf": "^2.4.4",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.6.0",
"tslint-plugin-prettier": "^1.3.0",
"typescript": "^2.3.2",
"vscode": "^1.1.0"
},
"dependencies": {
"@types/debug": "^0.0.29",
"@types/mkdirp": "^0.3.29",
"@types/q": "^1.0.0",
"braces": "^2.2.2",
"debug": "^2.6.7",
"mkdirp": "^0.5.1",
"q": "^1.4.1"
]
}
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"pretest": "npm run lint",
"test": "node ./node_modules/vscode/bin/test",
"lint": "tslint src/**/*.ts",
"lint:fix": "npm run lint -- --fix",
"contrib:add": "all-contributors add",
"contrib:generate": "all-contributors generate"
},
"devDependencies": {
"@types/expect.js": "^0.3.29",
"@types/mocha": "^2.2.41",
"@types/mockery": "^1.4.29",
"@types/node": "^7.0.18",
"@types/rimraf": "^0.0.28",
"all-contributors-cli": "^4.5.1",
"mocha": "^3.4.1",
"mockery": "^1.4.0",
"prettier": "^1.7.4",
"rimraf": "^2.4.4",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.6.0",
"tslint-plugin-prettier": "^1.3.0",
"typescript": "^2.3.2",
"vscode": "^1.1.0"
},
"dependencies": {
"@types/debug": "^0.0.29",
"@types/mkdirp": "^0.3.29",
"@types/q": "^1.0.0",
"braces": "^2.2.2",
"debug": "^2.6.7",
"mkdirp": "^0.5.1",
"q": "^1.4.1"
}
}
Loading

0 comments on commit 0ba5ceb

Please sign in to comment.