diff --git a/lib/tree-view-open-files-pane-view.coffee b/lib/tree-view-open-files-pane-view.coffee index 39d0dda..d8fb135 100644 --- a/lib/tree-view-open-files-pane-view.coffee +++ b/lib/tree-view-open-files-pane-view.coffee @@ -88,7 +88,36 @@ class TreeViewOpenFilesPaneView title = item.getLongTitle() if entry = @entryForItem(item) - $(entry.element).find('.name').text title + $(entry.element).find('.name').text(title) + + atom.config.observe 'tree-view-open-files.filePath', (filePath) => + if filePath + if itemPath = item.getPath?() + titlePathElement = document.createElement('span') + titlePathElement.setAttribute('class', 'file-path') + + projectDirElement = document.createElement('span') + projectDirElement.setAttribute('class', 'project-dir-name') + titlePathElement.textContent = ' <- ' + + for rootDir in atom.project.rootDirectories + if itemPath.indexOf(rootDir.path) > -1 + itemPath = itemPath.replace(rootDir.path, '') + if atom.project.rootDirectories.length > 1 + projectName = rootDir.path.split('/').slice(-1)[0] + else + projectName = '...' + + + projectDirElement.textContent = projectName + itemPathElement = document.createElement('span') + itemPathElement.textContent = itemPath + titlePathElement.appendChild(projectDirElement) + titlePathElement.appendChild(itemPathElement) + + $(entry.element).find('.name').append titlePathElement + else + $(entry.element).find('.name').find('.file-path').remove() updateModifiedState: (item, modified) -> entry = @entryForItem(item) diff --git a/lib/tree-view-open-files-view.coffee b/lib/tree-view-open-files-view.coffee index 22414ab..94bdf05 100644 --- a/lib/tree-view-open-files-view.coffee +++ b/lib/tree-view-open-files-view.coffee @@ -22,6 +22,9 @@ class TreeViewOpenFilesView @configSub = atom.config.observe 'tree-view-open-files.maxHeight', (maxHeight) => @element.style.maxHeight = if maxHeight > 0 then "#{maxHeight}px" else 'none' + @configSub = atom.config.observe 'tree-view-open-files.overflow', (overflow) => + @element.style.overflow = if overflow then "visible" else 'auto' + addTabGroup: (pane) -> group = new TreeViewOpenFilesPaneView group.setPane pane diff --git a/lib/tree-view-open-files.coffee b/lib/tree-view-open-files.coffee index c31f2cb..8cef7c6 100644 --- a/lib/tree-view-open-files.coffee +++ b/lib/tree-view-open-files.coffee @@ -11,6 +11,16 @@ module.exports = min: 0 description: 'Maximum height of the list before scrolling is required. Set to 0 to disable scrolling.' + overflow: + type: 'boolean' + default: true + description: 'If checked list will be expanded with opening files (overflow: visible)' + + filePath: + type: 'boolean' + default: true + description: 'Show file paths after file name' + activate: (state) -> requirePackages('tree-view').then ([treeView]) => @treeViewOpenFilesView = new TreeViewOpenFilesView diff --git a/package.json b/package.json index e758d72..206349e 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,65 @@ { - "name": "tree-view-open-files", - "main": "./lib/tree-view-open-files", - "version": "0.3.0", - "description": "Show open files in a list above the tree view.", - "repository": "https://github.com/postcasio/tree-view-open-files", - "license": "MIT", - "engines": { - "atom": ">=1.1.0" + "_args": [ + [ + { + "raw": "/tmp/d-116928-7039-k171f1/package.tgz", + "scope": null, + "escapedName": null, + "name": null, + "rawSpec": "/tmp/d-116928-7039-k171f1/package.tgz", + "spec": "/tmp/d-116928-7039-k171f1/package.tgz", + "type": "local" + }, + "/tmp/apm-install-dir-116928-7039-7s29xr" + ] + ], + "_from": "../d-116928-7039-k171f1/package.tgz", + "_id": "tree-view-open-files@0.3.0", + "_inCache": true, + "_installable": true, + "_location": "/tree-view-open-files", + "_phantomChildren": {}, + "_requested": { + "raw": "/tmp/d-116928-7039-k171f1/package.tgz", + "scope": null, + "escapedName": null, + "name": null, + "rawSpec": "/tmp/d-116928-7039-k171f1/package.tgz", + "spec": "/tmp/d-116928-7039-k171f1/package.tgz", + "type": "local" + }, + "_requiredBy": [ + "#USER" + ], + "_resolved": "file:../d-116928-7039-k171f1/package.tgz", + "_shasum": "8cca29fd0bfa05c2a4c593ce0b86377220c2e514", + "_shrinkwrap": null, + "_spec": "/tmp/d-116928-7039-k171f1/package.tgz", + "_where": "/tmp/apm-install-dir-116928-7039-7s29xr", + "bugs": { + "url": "https://github.com/postcasio/tree-view-open-files/issues" }, "dependencies": { "atom-utils": ">=0.7.4", "event-kit": "^0.8.0", "lodash": "^2.4.1", "space-pen": "^3.8.0" - } + }, + "description": "Show open files in a list above the tree view.", + "devDependencies": {}, + "engines": { + "atom": ">=1.1.0" + }, + "homepage": "https://github.com/postcasio/tree-view-open-files#readme", + "license": "MIT", + "main": "./lib/tree-view-open-files", + "name": "tree-view-open-files", + "optionalDependencies": {}, + "readme": "# tree-view-open-files\n\nShow open files in a list above the tree view. (like Sublime Text)\n\nShows a separate collapsible list for each pane.\n\n## Todo\n\n* Allow panes to be renamed\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "git+https://github.com/postcasio/tree-view-open-files.git" + }, + "version": "0.3.0" } diff --git a/styles/tree-view-open-files.less b/styles/tree-view-open-files.less index 1dc9199..856cf2c 100644 --- a/styles/tree-view-open-files.less +++ b/styles/tree-view-open-files.less @@ -14,7 +14,16 @@ position: relative; order: 0; + .file-path { + color: rgba(171, 173, 164, 0.33); + + .project-dir-name { + font-weight: bold; + } + } + .close-open-file { + visibility: hidden; background: none; border: none; margin-left: -24px; @@ -26,6 +35,12 @@ } } + .list-item:hover { + .close-open-file { + visibility: visible; + } + } + .close-open-file::before { font-family: 'Octicons Regular'; font-weight: normal;