Skip to content

Commit 76e6011

Browse files
chore(release): 2.17.0 [skip ci]
1 parent a5546b9 commit 76e6011

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [2.17.0](https://github.com/atom-community/autocomplete-paths/compare/v2.16.0...v2.17.0) (2021-11-29)
2+
3+
4+
### Features
5+
6+
* add setting to show image preview ([#188](https://github.com/atom-community/autocomplete-paths/issues/188)) ([a5546b9](https://github.com/atom-community/autocomplete-paths/commit/a5546b9d43a8adfc0d9f720b2f0f1c5ba1dc6782))
7+
18
# [2.16.0](https://github.com/atom-community/autocomplete-paths/compare/v2.15.2...v2.16.0) (2021-11-29)
29

310

dist/autocomplete-paths.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ class $b15434387a78119d$var$PathsProvider extends $igPDg$events.EventEmitter {
163163
if (fuzzyMatcher) files = (0, $igPDg$zadeh.filter)(files, fuzzyMatcher, {
164164
maxResults: 10
165165
});
166+
const showImagePreview = atom.config.get("autocomplete-paths.imagePreview");
167+
const imgRegex = /\.(png|svg|jpg|jpeg|jfif|pjpeg|pjp|gif|apng|ico|cur)$/;
166168
const suggestions = files.map((pathName)=>{
167169
let text = pathName;
168170
const normalizeSlashes = atom.config.get("autocomplete-paths.normalizeSlashes");
171+
const absolutePath = $b15434387a78119d$var$_path.default.resolve($b15434387a78119d$var$_path.default.dirname(request2.editor.getPath()), pathName);
169172
const projectRelativePath = atom.project.relativizePath(text)[1];
170173
let displayText = projectRelativePath;
171174
if (directoryGiven) displayText = $b15434387a78119d$var$_path.default.relative(requestedDirectoryPath, text);
@@ -188,12 +191,13 @@ class $b15434387a78119d$var$PathsProvider extends $igPDg$events.EventEmitter {
188191
});
189192
// Calculate distance to file
190193
const distanceToFile = relativePath.split($b15434387a78119d$var$_path.default.sep).length;
194+
const iconHTML = showImagePreview && imgRegex.test(absolutePath) ? `<image style="background-position: center; background-repeat: no-repeat; background-size: contain; background-image: url(${absolutePath}); height:29px; width:29px;"></image>` : '<i class="icon-file-code"></i>';
191195
return {
192196
text: text,
193197
replacementPrefix: pathPrefix,
194198
displayText: displayText,
195199
type: "import",
196-
iconHTML: '<i class="icon-file-code"></i>',
200+
iconHTML: iconHTML,
197201
score: (0, $igPDg$zadeh.score)(displayText, request2.prefix),
198202
distanceToFile: distanceToFile
199203
};
@@ -13990,6 +13994,11 @@ const $661f0ec0189dd3b0$var$config = {
1399013994
default: false,
1399113995
description: "Follow directory symlinks. Disable if you have a self-referencing symlink."
1399213996
},
13997+
imagePreview: {
13998+
type: "boolean",
13999+
default: false,
14000+
description: "Show preview icon for images."
14001+
},
1399314002
ignoredNames: {
1399414003
type: "boolean",
1399514004
default: true,

dist/autocomplete-paths.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "autocomplete-paths",
3-
"version": "2.16.0",
3+
"version": "2.17.0",
44
"description": "Adds path autocompletion to autocomplete+",
55
"repository": "https://github.com/atom-community/autocomplete-paths",
66
"license": "MIT",

0 commit comments

Comments
 (0)