Code Monkey home page Code Monkey logo

fuzzyfilepath's People

Contributors

corbanmailloux avatar evandrocoan avatar wt- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fuzzyfilepath's Issues

FFP post cleanup path:' merge set ' ~~> ' merge set '

Wrongly replaces Packges/A file icon/icons/single/file_type_slim.png with .../file_type merge set

back2

This the console output with debug (log) set to true:

FFP	 CurrentState Abort -- view already updated
FFP	 SelectedTrigger {'auto': False, 'extensions': ['js', 'html', 'css', 'scss', 'less', 'png', 'gif', 'jpeg', 'jpg', 'svg'], 'scope': 'source', 'relative': True}
FFP	 search "" F:/SublimeText/Data ['js', 'html', 'css', 'scss', 'less', 'png', 'gif', 'jpeg', 'jpg', 'svg'] False
FFP	 2 completions found
FFP	 post cleanup path:'  merge set ' ~~> '  merge set '
FFP	 CurrentState Abort -- view already updated

Completions are not suggested and fix doesn't work

Hi, I'm on Windows and latest version of Sublime. I get suggestions only if I force them, I tried the "scopes" fix adding this to the user settings:

{
    "scopes": [
        {
            "scope": ".",
            "auto": true,
            // add your extensions here:
            "extensions": ["css", "html", "js"]
        }
    ]
}

but it doesn't work. If I use keyboard shortcuts to insert paths it works. Can somebody help me with this?

[Feature request] Add full relative paths for JavaScript files by default

Request

Add automatic detection of folder structures for JavaScript links like in the CSS links.

Justification

For example, my project structure:

|-- example1.html
|-- folder1
|   |-- example2.html
|-- folder2
|   |-- test.js

If I want link to test.js file in example1.html file I need <script src="./folder2/test.js"></script>. But if I want link to test.js file in example2.html file, I need print in my code <script src="../folder2/test.js"></script>. I want, to FuzzyFilePath able to determine automatically how many points need to set the name of the file.

Extended behavior

FuzzyFilePath for CSS:

FuzzyFilePath for CSS

Actual behavior

FuzzyFilePath for JavaScript:

FuzzyFilePath for JavaScript

Thanks.

omit extension?

Is there a way to customize this plugin to omit the file extension?

Thanks!

[Bug] GotoFile failed finding file

Summary

I can not open files, I referenced in my HTML-documents.

Expected behavior

Successful open files.

Actual behavior

I included log: true, in my sublime-settings file. When I run ffp_goto_file command, I get output in console — FFP GotoFile failed finding file $Path to my file. Example:

FFP  GotoFile failed finding file E:\wamp\www\articles_css\style_right.css

Steps to reproduce

Example of my code: https://github.com/Kristinita/Kristinita.github.io/blob/master/Sublime-Text/SashaSublime.html#L108

<!-- Иконочка Сашеньки -->
<link rel="shortcut icon" href="../other_images/Sasha.ico" type="image/x-icon">
<link rel="icon" href="../other_images/Sasha.ico" type="image/x-icon">
<!-- Стиль страницы -->
<link rel="stylesheet" href="../articles_css/style_right.css">
<link rel="stylesheet" type="text/css" href="../bower-components/rainbow/themes/css/espresso-libre.css">

I put cursor in any place between quotes between href → I run ffp_goto_file command → my files do not open, I get error in console.

All relative paths is correct. I also insert absolute paths, but I get same result.

Environment

Operating system and version:
Windows 10.0.14393
Sublime Text:
Build 3126

Thanks.

prefix only works if on the same line

In a project I work on there are AMD modules like so:

define(
  [
    'foo/bar',
    'bar/baz'
 ],

 function (bar, baz) {
 }
)

FFP does not trigger with this style of define. I have to write the string on the same line as define for it to trigger. I can manually trigger it with the key command, but then my custom replace operation does not fire for the scope.

This may be difficult to fix, but it is an issue.

Lag while opening a new project, FuzzyFilePath cached ... files in ...

When I open a project my console with filled with:

FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data
FuzzyFilePath cached 3218 files in D:/SublimeText/Data

Which keep showing some minutes and keep plugin_host using 100% my CPU, until some minutes later it stops showing up new messages FuzzyFilePath cached 3218 files in D:/SublimeText/Data and then plugin_host stops using 100% my CPU.

Environment

  • Operating system and version:
    • Windows 10 build 15063 x64
    • Mac OS ...
    • Linux ...
  • Monitor:
    • Resolution 1920x1080
    • dpi_scale used in ST 1.0
  • Sublime Text:
    • Build 3142
    • 32 bit

Related:

  1. #27 Index out of date

Image Sourcing Bug

It's putting a "" sign before which is not needed and so image source is not working.

It should be:
<img src="img/logo _2.png"

It is giving:
<img src="/img/logo _2.png"
http://prntscr.com/hs6pa6

Please suggest ways so I can fix this; thanks!

TypeError: object of type 'bool' has no len()

Hey Guys,

i am trying to use FFP with ST3 on my Windows 10 machine.

I tried everything and i'm out of ideas, why it doesn't work.

Actviated debugging and logging and the console outputs:

Traceback (most recent call last): File "C:\Program Files (x86)\Sublime Text 3\sublime_plugin.py", line 359, in on_query_completions res = callback.on_query_completions(v, prefix, locations) File "QueryCompletionListener in C:\Users\Philipp\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 32, in on_query_completions File "FuzzyFilePath in C:\Users\Philipp\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 319, in on_query_completions File "FuzzyFilePath in C:\Users\Philipp\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 213, in build File "FuzzyFilePath in C:\Users\Philipp\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 240, in build_needle_query TypeError: object of type 'bool' has no len()

This happens as soon, as i try to use src in a script tag. But it also wont work with image tages or any other tags. Also added the scope for everything from the Docs. Any hints?

Prefix in latex

I would like to create a scope that triggers on \input{}:

    "scopes": [
        {
            "scope": "text.tex.latex",
            "extensions": ["tex", "tikz"],
            //"prefix": ["input"],
            "auto": true,
        },
    ]

This does not work, since input is followed by a curly brace and this is unsupported by FuzzyFilePath. Would you please consider supporting this as well?

If it matters, I am on Ubuntu with ST3 Build 3080 and the package installed through the package manager.

The above defined scope works, if I comment out the prefix.

(I was wondering, whether defining of scopes inside *.sublime-project is supported?)

Add JS "import ... from" statement to default prefixes

It's already become quite common to use the import keyword in JavaScript, would be nice to have this support right out of the box.

I tried adding in a regex for it to the prefixes array in User settings but couldn't get it to match despite having a valid regex.

Line 641, in __getitem__ raise IndexError()

It just popped on my console, but I do not know how reproduce it yet.

Traceback (most recent call last):
  File "D:\SublimeText\sublime_plugin.py", line 664, in on_post_text_command
    callback.on_post_text_command(v, name, args)
  File "QueryCompletionListener in D:\SublimeText\Data\Installed Packages\FuzzyFilePath.sublime-package", line 82, in on_post_text_command
  File "common.selection in D:\SublimeText\Data\Installed Packages\FuzzyFilePath.sublime-package", line 7, in get_line
  File "common.selection in D:\SublimeText\Data\Installed Packages\FuzzyFilePath.sublime-package", line 4, in get_position
  File "D:\SublimeText\sublime.py", line 641, in __getitem__
    raise IndexError()
IndexError

Keyboard conflict with Windows

Hi,

Thanks for the great work!

But... ctrl+super+space collides with windows input method selection. As a default, there might be some other shortcut better.

Thanks for reading

FuzzyFilePath is unaware for changes outside sublime

FuzzyFilePath is unaware for changes outside sublime, only restarting sublime or disable - enable the plugin do the trick.

for what it's worth,
here are the very specific steps I make:
1 .open sublime
2. create files outside sublime (in my case, install something with bower)
3 .go to html file and use the auto suggestions in

<script src="|"></script>

other then that, your plugin is awesome and so do you.

insert path is not work properly

My project structure is as follows

c:\myproject\
        assets\
            css\
                 style.css
                 font.css
            js\
              jquery.js
              modernizr.js
           img\
    index.html

in html scope, I set relative to true.
Then in my html document, I added a css stylesheet
however it fill with preceding ../ and it is not working.

    <link rel="stylesheet" href="../assets/css/style.css">

the correct path should be

    <link rel="stylesheet" href="assets/css/style.css">

Extension Stopped working

I guess after the update the extension stopped working

When executing extension's commands with (ctrl + shift + p) I get this:

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 393, in on_text_command
    res = callback.on_text_command(v, name, args)
  File "QueryCompletionListener in /home/joaco/.config/sublime-text-3/Installed Packages/FuzzyFilePath.sublime-package", line 74, in on_text_command
AttributeError: 'module' object has no attribute 'get'
Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 421, in on_post_text_command
    callback.on_post_text_command(v, name, args)
  File "QueryCompletionListener in /home/joaco/.config/sublime-text-3/Installed Packages/FuzzyFilePath.sublime-package", line 83, in on_post_text_command
AttributeError: 'module' object has no attribute 'get'

NameError: global name 'Path' is not defined

I install the plugin from git and it's loaded on Sublime Text 3 Build 3095

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 158, in on_api_ready
    m.plugin_loaded()
  File "/Users/ken/Library/Application Support/Sublime Text 3/Packages/FuzzyFilePath/FuzzyFilePath.py", line 38, in plugin_loaded
    update_settings()
  File "/Users/ken/Library/Application Support/Sublime Text 3/Packages/FuzzyFilePath/FuzzyFilePath.py", line 50, in update_settings
    global_settings = Settings.update()
  File "/Users/ken/Library/Application Support/Sublime Text 3/Packages/FuzzyFilePath/common/settings.py", line 44, in update
    global_settings["PROJECT_DIRECTORY"] = Path.sanitize_base_directory(global_settings["PROJECT_DIRECTORY"])
NameError: global name 'Path' is not defined

Support of project settings "scopes"

Currently some project specific settings may be bugged and instead user settings are used as the current settings. Within the command palette: "FuzzyFilePath: Show current settings" will open a new view with the currently merged and used settings (somewhat modified internally).

This should help debugging. Project settings should be the last object merged while retrieving final settings. The final settings hierarchy should look sth like:

(last)
....
project settings
....
user settings
....
default settings
....
config
....
(first)

Easily add triggers to FFP settings

In sublime, there's a FuzzyFilePath.sublime-settings in Packages/User/. When try to add more triggers to FFP, like to make settings file:

    {
        "scopes": [
            {
                // js - *.src = ""
                "scope": "source\\.js.*string",
                "prefix": ["src"],

                "auto": true,
                "base_directory": true,
                "extensions": ["js", "png", "gif", "jpg", "jpeg"],
                "relative": true
            },
            {
                "scope": "\\.python",
                "extensions": ["py"],
                "auto": true,
                "prefix": ["from", "import"],
                "relative": false,
                "replace_on_insert": [
                    ["^\\/", ""], // remove first slash
                    ["\\/", "."], // replace slashed by dots
                    ["^(.*)\\.py$", ""], // remove file extension
                ]
            }
        ]
    }

then it would overwrite the original scopes setting, and all that works are just js and py. To make it function like before, you should manually copy all the scopes from original settings file to the user one.

Is there a better way to add triggers to the scopes but not just completely overwrite it?

How to stop this from messing with my project file?

How to stop this from messing with my project file?

I for now I have to uninstall this package for it, because it is just unacceptable;
Also Know As: there is a setting to disable it writing to my project file?

image

Error when attempting to "Find All"

To reproduce error:

  1. Press ctrl+f (find shortcut)
  2. Press alt+enter (find all shortcut)

Stacktrace:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 818, in run_
    return self.run(edit)
  File "command_goto_file in C:\Users\Alex\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 18, in run
  File "./python3.3/ntpath.py", line 256, in dirname
  File "./python3.3/ntpath.py", line 220, in split
  File "./python3.3/ntpath.py", line 162, in splitdrive
TypeError: object of type 'NoneType' has no len()

It doesn't work on windows subl 3083 any more

It doesn't work on windows subl 3083 any more. because it find the wrong currently working project
directory.
By the way, why it always trim the file suffix (.js) in the script tag, even through I have already overwritted the config the *.sublime-project???
2016-05-26_233836

Autocomplete pallet does not show in css strings

I have the following scope

      {
          // postcss - composes from ""
          // source.postcss meta.property-list.css.postcss string.quoted.single.css.postcss
          "scope": "source.postcss meta.property-list.css.postcss string.quoted.single.css.postcss",
          // *: url
          "prefix": ["from"],

          "auto": true,
          "extensions": ["css"],
          "relative": false,
          "base_directory": true,
          "replace_on_insert": [
            // remove base directory
            ["^\\/js/", ""]
          ]
      },

Using the following CSS the autocomplete pallet does not show up.

.even {
  composes: label from 'FormLabel'

  background-color: rgba(0, 0, 0, 0.2);
}

Logging shows the following.

FFP  | => 2 completions found
FFP 

Hitting ctrl + space auto completes the path as expected.

Using the following settings gets the autocomplete pallet to show up.

      {
          // postcss - composes from ""
          // source.postcss meta.property-list.css.postcss string.quoted.single.css.postcss
          "scope": "source.postcss meta.property-list.css.postcss",
          // *: url
          "prefix": ["from"],

          "auto": true,
          "extensions": ["css"],
          "relative": false,
          "base_directory": true,
          "replace_on_insert": [
            // remove base directory
            ["^\\/js/", ""]
          ]
      },

I can't figure out why adding string.quoted.single.css.postcss keeps the pallet from showing up, but FuzzyFilePath seems to be working for the correct scope, only the pallet is missing.

Add support for multiple independent folders

On line 89 of "FuzzyFilePath/project/ProjectManager.py", it says "multiple independent folders are not yet supported, which results in ignored folders"... I would like to see this functionality added.

It would also be nice if I could set the "project_directory" and "base_directory" for each of these independent folders separately.

Breaks snippet

Not sure if it's because my snippet has quotes in it or because it uses multiple cursors

Snippet:

<snippet>
	<content><![CDATA[console.log("${1}:", ${1});]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>cl</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<scope>source.js</scope>
</snippet>

How the snippets works normally:
image

How the snippets works with FFP enabled:

image

Python from completion not being erased and filled with spaces

back2

"""
# from sub

"""

Console with debug:

FFP  search s F:/SublimeText/Data ['py'] False
FFP  2 completions found
FFP  CurrentState Abort -- view already updated
FFP  SelectedTrigger {'auto': True, 'extensions': ['py'], 'replace_on_insert': [['^\\/', ''], ['\\/', '.'], ['^(.*)\\.py$', 'FuzzyFilePath.\\1']], 'prefix': ['from'], 'scope': '\\.python', 'relative': False}
FFP  search sub F:/SublimeText/Data ['py'] False
FFP  2 completions found
FFP  post cleanup path:' sub

"" ' ~~> ' sub

"" '
FFP  CurrentState Abort -- view already updated
FFP  CurrentState Abort -- view already updated
FFP  CurrentState Abort -- view already updated

This only happens when the commit_completion is triggered by an indirection like this:

class OverwriteCommitCompletionCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        window = self.view.window()
        window.run_command( "commit_completion" )

On autocompletion event, I call the command overwrite_commit_completion which just calls the commit_completion. This should be the same cause of the problem: #49 (FFP post cleanup path:' merge set ' ~~> ' merge set ')

Comment out this line on this package, fixes the problem:

self.on_post_insert_completion(view, command_name)

When the commit_completion command is not redirected, this is the console output from my debugging:

start tracking: ``
start tracking: ``
finish tracking
expression: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5117), 'style': None, 'prefix': 'from', 'needle': 'sublime', 'word': 'sublime'}`
expression['needle']: `sublime`
diff['start']:        ``
result 1: `sublime`
result 2: `sublime`
base_directory: `False`
replace_on_insert: `[['^\\/', ''], ['\\/', '.'], ['^(.*)\\.py$', 'FuzzyFilePath.\\1']]`
post_remove: ``, arguments: `{'b': 5117, 'string': 'sublime', 'a': 5110, 'move_cursor': True}`
end

When there is the mentioned redirection, this is the console output:

start tracking: ``
start tracking: ``
finish tracking
expression: `{'error': <_sre.SRE_Match object at 0x04E15480>, 'tagName': None, 'valid_needle': False, 'is_valid': False, 'region': (5110, 5117), 'style': None, 'prefix': 'from', 'needle': 'sub\n\n\n"', 'word': 'sub\n\n\n"'}`
expression['needle']: `sub


"`
diff['start']:        ``
result 1: `sub


"`
result 2: `sub


"`
base_directory: `False`
replace_on_insert: `[['^\\/', ''], ['\\/', '.'], ['^(.*)\\.py$', 'FuzzyFilePath.\\1']]`
post_remove: ``, arguments: `{'b': 5117, 'string': 'sub\n\n\n"', 'a': 5110, 'move_cursor': True}`
end

Now I added more debugging power:

This is without the indirection:

position: `5113`
word_region: `(5110, 5113)`
line_region: `(5103, 5113)`
pre_region:  `(5103, 5110)`
post_region: `(5113, 5113)`
line: `# from sub`
word: `sub`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5113)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x03A9A650>`
needle:        `sub`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5113)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x03A9A650>`
post_quotes:   `<_sre.SRE_Match object at 0x08B92DA0>`
needle:        `sub`
needle_region: `(5110, 5113)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x053BB760>`
prefix 2: `<_sre.SRE_Match object at 0x053BB760>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5113), 'style': None, 'prefix': 'from', 'needle': 'sub', 'word': 'sub'}`
start tracking: ``
position: `5113`
word_region: `(5110, 5113)`
line_region: `(5103, 5113)`
pre_region:  `(5103, 5110)`
post_region: `(5113, 5113)`
line: `# from sub`
word: `sub`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5113)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x03A9A458>`
needle:        `sub`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5113)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x03A9A458>`
post_quotes:   `<_sre.SRE_Match object at 0x053BB760>`
needle:        `sub`
needle_region: `(5110, 5113)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x053BB720>`
prefix 2: `<_sre.SRE_Match object at 0x053BB720>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5113), 'style': None, 'prefix': 'from', 'needle': 'sub', 'word': 'sub'}`
position: `5113`
word_region: `(5110, 5113)`
line_region: `(5103, 5113)`
pre_region:  `(5103, 5110)`
post_region: `(5113, 5113)`
line: `# from sub`
word: `sub`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5113)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x03940F98>`
needle:        `sub`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5113)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x03940F98>`
post_quotes:   `<_sre.SRE_Match object at 0x08B92DA0>`
needle:        `sub`
needle_region: `(5110, 5113)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x053BB760>`
prefix 2: `<_sre.SRE_Match object at 0x053BB760>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5113), 'style': None, 'prefix': 'from', 'needle': 'sub', 'word': 'sub'}`
start tracking: ``
finish tracking
position: `5117`
word_region: `(5110, 5117)`
line_region: `(5103, 5117)`
pre_region:  `(5103, 5110)`
post_region: `(5117, 5117)`
line: `# from sublime`
word: `sublime`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5117)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x03A9A458>`
needle:        `sublime`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5117)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x03A9A458>`
post_quotes:   `<_sre.SRE_Match object at 0x08B92DA0>`
needle:        `sublime`
needle_region: `(5110, 5117)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x053BB760>`
prefix 2: `<_sre.SRE_Match object at 0x053BB760>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5117), 'style': None, 'prefix': 'from', 'needle': 'sublime', 'word': 'sublime'}`
end

This is with the indirection:

position: `5113`
word_region: `(5110, 5113)`
line_region: `(5103, 5113)`
pre_region:  `(5103, 5110)`
post_region: `(5113, 5113)`
line: `# from sub`
word: `sub`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5113)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x062F64A0>`
needle:        `sub`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5113)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x062F64A0>`
post_quotes:   `<_sre.SRE_Match object at 0x052A7460>`
needle:        `sub`
needle_region: `(5110, 5113)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x08B92CE0>`
prefix 2: `<_sre.SRE_Match object at 0x08B92CE0>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5113), 'style': None, 'prefix': 'from', 'needle': 'sub', 'word': 'sub'}`
start tracking: ``
position: `5113`
word_region: `(5110, 5113)`
line_region: `(5103, 5113)`
pre_region:  `(5103, 5110)`
post_region: `(5113, 5113)`
line: `# from sub`
word: `sub`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5113)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x04E18A40>`
needle:        `sub`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5113)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x04E18A40>`
post_quotes:   `<_sre.SRE_Match object at 0x08B92CE0>`
needle:        `sub`
needle_region: `(5110, 5113)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x08B926A0>`
prefix 2: `<_sre.SRE_Match object at 0x08B926A0>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5113), 'style': None, 'prefix': 'from', 'needle': 'sub', 'word': 'sub'}`
position: `5113`
word_region: `(5110, 5113)`
line_region: `(5103, 5113)`
pre_region:  `(5103, 5110)`
post_region: `(5113, 5113)`
line: `# from sub`
word: `sub`
pre:  `# from `
post: ``
error: `None`
needle_region: `(5110, 5113)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x06555F98>`
needle:        `sub`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5113)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x06555F98>`
post_quotes:   `<_sre.SRE_Match object at 0x052A7460>`
needle:        `sub`
needle_region: `(5110, 5113)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x08B92CE0>`
prefix 2: `<_sre.SRE_Match object at 0x08B92CE0>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `True`
valid_needle: `True`
results: `{'error': None, 'tagName': None, 'valid_needle': True, 'is_valid': True, 'region': (5110, 5113), 'style': None, 'prefix': 'from', 'needle': 'sub', 'word': 'sub'}`
start tracking: ``
finish tracking
position: `5117`
word_region: `(5110, 5117)`
line_region: `(5103, 5117)`
pre_region:  `(5103, 5110)`
post_region: `(5117, 5117)`
line: `# from sub


"`
word: `sub


"`
pre:  `# from `
post: ``
error: `<_sre.SRE_Match object at 0x05D276B0>`
needle_region: `(5110, 5117)`
pre_quotes 1: `None`
pre_quotes 2: `<_sre.SRE_Match object at 0x04E18A40>`
needle:        `sub


"`
separator:     ` `
pre_match:     ``
needle_region: `(5110, 5117)`
pre_quotes 3:  `<_sre.SRE_Match object at 0x04E18A40>`
post_quotes:   `<_sre.SRE_Match object at 0x052A7460>`
needle:        `sub


"`
needle_region: `(5110, 5117)`
valid:         `True`
prefix_line:   `# from`
prefix_region: `(5103, 5109)`
prefix 1: `<_sre.SRE_Match object at 0x08B92CE0>`
prefix 2: `<_sre.SRE_Match object at 0x08B92CE0>`
prefix 3: `from`
tag 1: `None`
tag 2: `None`
propertyName 1: `None`
propertyName 2: `None`
valid: `False`
valid_needle: `False`
results: `{'error': <_sre.SRE_Match object at 0x05D276B0>, 'tagName': None, 'valid_needle': False, 'is_valid': False, 'region': (5110, 5117), 'style': None, 'prefix': 'from', 'needle': 'sub\n\n\n"', 'word': 'sub\n\n\n"'}`
end


Patched function:

File: Data/Packages/FuzzyFilePath/expression.py
 16: def get_context(view):
 17:    error = False
 18:    valid = True
 19:    valid_needle = True
 20:    position = Selection.get_position(view)
 21: 
 22:    print("position: `%s`" % position)
 23: 
 24:    # regions
 25:    word_region = view.word(position)
 26:    line_region = view.line(position)
 27:    pre_region = sublime.Region(line_region.a, word_region.a)
 28:    post_region = sublime.Region(word_region.b, line_region.b)
 29: 
 30:    print("word_region: `%s`" % word_region)
 31:    print("line_region: `%s`" % line_region)
 32:    print("pre_region:  `%s`" % pre_region)
 33:    print("post_region: `%s`" % post_region)
 34: 
 35:    # text
 36:    line = view.substr(line_region)
 37:    word = view.substr(word_region)
 38:    pre = view.substr(pre_region)
 39:    post = view.substr(post_region)
 40: 
 41:    print("line: `%s`" % line)
 42:    print("word: `%s`" % word)
 43:    print("pre:  `%s`" % pre)
 44:    print("post: `%s`" % post)
 45: 
 46:    error = re.search("[" + NEEDLE_INVALID_CHARACTERS + "]", word)
 47:    needle_region = view.word(position)
 48: 
 49:    print("error: `%s`" % error)
 50:    print("needle_region: `%s`" % needle_region)
 51: 
 52:    # grab everything in 'separators'
 53:    needle = ""
 54:    separator = False
 55:    pre_match = ""
 56:    # search for a separator before current word, i.e. <">path/to/<position>
 57:    pre_quotes = re.search("(["+NEEDLE_SEPARATOR_BEFORE+"])([^"+NEEDLE_SEPARATOR+"]*)$", pre)
 58: 
 59:    print("pre_quotes 1: `%s`" % pre_quotes)
 60: 
 61:    if pre_quotes:
 62:        needle += pre_quotes.group(2) + word
 63:        separator = pre_quotes.group(1)
 64:        pre_match = pre_quotes.group(2)
 65:        needle_region.a -= len(pre_quotes.group(2))
 66:    else:
 67:        # use whitespace as separator
 68:        pre_quotes = re.search("(\s)([^"+NEEDLE_SEPARATOR+"\s]*)$", pre)
 69:        print("pre_quotes 2: `%s`" % pre_quotes)
 70: 
 71:        if pre_quotes:
 72:            needle = pre_quotes.group(2) + word
 73:            separator = pre_quotes.group(1)
 74:            pre_match = pre_quotes.group(2)
 75:            needle_region.a -= len(pre_quotes.group(2))
 76: 
 77:    print("needle:        `%s`" % needle)
 78:    print("separator:     `%s`" % separator)
 79:    print("pre_match:     `%s`" % pre_match)
 80:    print("needle_region: `%s`" % needle_region)
 81: 
 82:    if pre_quotes:
 83:        post_quotes = re.search("^(["+NEEDLE_SEPARATOR_AFTER+"]*)", post)
 84:        if post_quotes:
 85:            needle += post_quotes.group(1)
 86:            needle_region.b += len(post_quotes.group(1))
 87:        else:
 88:            logger.verbose(ID, "no post quotes found => invalid")
 89:            valid = False
 90:    elif not re.search("["+NEEDLE_INVALID_CHARACTERS+"]", needle):
 91:        needle = pre + word
 92:        needle_region.a = pre_region.a
 93:    else:
 94:        needle = word
 95: 
 96:    print("pre_quotes 3:  `%s`" % pre_quotes)
 97:    print("post_quotes:   `%s`" % post_quotes)
 98:    print("needle:        `%s`" % needle)
 99:    print("needle_region: `%s`" % needle_region)
100:    print("valid:         `%s`" % valid)
101: 
102:    # grab prefix
103:    prefix_region = sublime.Region(line_region.a, pre_region.b - len(pre_match) - 1)
104:    prefix_line = view.substr(prefix_region)
105:    # # print("prefix line", prefix_line)
106: 
107:    print("prefix_line:   `%s`" % prefix_line)
108:    print("prefix_region: `%s`" % prefix_region)
109: 
110:    #define? (["...", "..."]) -> before?
111:    # before: ABC =:([
112:    prefix = re.search("\s*(["+NEEDLE_CHARACTERS+"]+)["+DELIMITER+"]*$", prefix_line)
113: 
114:    print("prefix 1: `%s`" % prefix)
115: 
116:    if prefix is None:
117:        # validate array, like define(["...", ".CURSOR."])
118:        prefix = re.search("^\s*(["+NEEDLE_CHARACTERS+"]+)["+DELIMITER+"]+", prefix_line)
119: 
120:    print("prefix 2: `%s`" % prefix)
121: 
122:    if prefix:
123:        # print("prefix:", prefix.group(1))
124:        prefix = prefix.group(1)
125: 
126:    print("prefix 3: `%s`" % prefix)
127: 
128:    tag = re.search("<\s*(["+NEEDLE_CHARACTERS+"]*)\s*[^>]*$", prefix_line)
129:    print("tag 1: `%s`" % tag)
130: 
131:    if tag:
132:        tag = tag.group(1)
133:        # print("tag:", tag)
134: 
135:    propertyName = re.search("[\s\"\'']*(["+NEEDLE_CHARACTERS+"]*)[\s\"\']*\:[^\:]*$", prefix_line)
136: 
137:    print("tag 2: `%s`" % tag)
138:    print("propertyName 1: `%s`" % propertyName)
139: 
140:    if propertyName:
141:        propertyName = propertyName.group(1)
142:        # print("style:", style)
143: 
144:    print("propertyName 2: `%s`" % propertyName)
145: 
146:    if separator is False:
147:        logger.verbose(ID, "separator undefined => invalid", needle)
148:        valid_needle = False
149:        valid = False
150:    elif re.search("["+NEEDLE_INVALID_CHARACTERS+"]", needle):
151:        logger.verbose(ID, "invalid characters in needle => invalid", needle)
152:        valid_needle = False
153:        valid = False
154:    elif prefix is None and separator.strip() == "":
155:        logger.verbose(ID, "prefix undefined => invalid", needle)
156:        valid = False
157: 
158:    print("valid: `%s`" % valid)
159:    print("valid_needle: `%s`" % valid_needle)
160: 
161:    results = {
162:        "is_valid": valid,
163:        "valid_needle": valid_needle,
164:        "needle": needle,
165:        "prefix": prefix,
166:        "tagName": tag,
167:        "style": propertyName,
168:        "region": needle_region,
169:        "word": word,
170:        # really do not use any of this
171:        "error": error
172:    }
173: 
174:    print("results: `%s`" % results)
175:    return results


Comparing both full debugging outputs we see that the only difference is the line contents. The start and end points are correct on both cases, but while using the completion indirection by a window command, the view.substr does not return the inserted text, but the old contents on the position before the completion take place.

Index out of date

Whenever I create or rename a file in my project, it seems to be missing from autocomplete suggestions. I need to restart Sublime in order to make them appear. Is it a bug, or am I missing a setting on how to refresh the index manually?

I'm using Sublime 3103 on 64bit Ubuntu

does not work on mac OS

does not work on mac OS.
The key mapping ctrl+alt+space is Mac OS X 10.10.x system hot key,
and when I remap it to other key it still doesn't work.
but it works fine on windows 7.

User settings doesn't work

Hello, again.

I'm trying to make my own trigger for .nunj files from Nunjucks with next trigger code

          "scope": "jinja",
          "prefix": ["include", "import"],
          "auto": true,
          "extensions": ["nunj"],
          "relative": false,
          "base_directory": false

I checked the the current settings via Ctrl+Shift+P FuzzyFilePath: Show current settings and even didn't find any mention of jinja. So it looks like user settings are not applied.

I'm on Windows, Sublime 3083 and FuzzyFilePath 0.2.2

No longer working 'ffp no filepaths found'

myself and a few other colleagues who have been using this package for a while have all recently noticed that it no longer works? It seems to be running but always fails with a 'no filepaths found' error bottom left. All using sublime text 3 on Windows.

node_modules is not being ignored

I've tried changing the settings to the previous way, but doesn't work either?.

Also, I've set my sublime to ignore the node_modules folder also, should this extension look at "folder_exclude_patterns" in sublime's settings?

Crash on sublimeText 3, build 3126 release 23rd Sep 2016

Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 634, in on_text_command res = callback.on_text_command(v, name, args) File "QueryCompletionListener in /Users/tonny/Library/Application Support/Sublime Text 3/Installed Packages/FuzzyFilePath.sublime-package", line 74, in on_text_command AttributeError: 'module' object has no attribute 'get'

Less conflict issue

I had to comment this out:

{
    // (s)css: import
    "scope": "(css|sass)\\s",

    "auto": true,
    "prefix": ["import"],
    "relative": false,
    "extensions": ["css", "scss"],
    "replace_on_insert": [
        ["\\.(css|scss)$", ""],
        ["^\\/bower_components\\/", ""]
    ]
},

For this to work:

{
    // css - import ""
    "scope": ".*\\.(css|sass|less)",
    // *: url
    "prefix": ["import"],

    "auto": true,
    "extensions": ["css", "scss", "less"],
    // "relative": true,
    "replace_on_insert": [
        // remove extension
        ["\\.(scss|less)$", ""],
    ]
},

Using the default settings.

replace_on_insert is not applied using tab

replace_on_insert is only applied if a selection is done by pressing enter. If only one valid completion remains, SublimeText autocompletes this entry triggering different events.

Confusion over relative paths

Really like this plugin. One thing I'm struggling to grasp is the relative paths.

Let's say my directory structure looks like this:

/fruits/apple.js
/veggies/corn.js

Now let's say I'm editing corn.js. If I type "app" then hit the relative auto completion shortcut I'd expect the inserted text to be relative to the current file. So I expect "../fruits/apple.js". Instead I get "/fruits/apple.js".

Is this as designed?

wrong filepath insertion for paths containing bower_components

triggering the autocomplete with ctrl+shift+space shows the correct path in the preview dropdown, but when you press enter, it puts in a path that does not match what I selected.

when I select this
/static/bower_components/angularUtils-pagination/dirPagination.js
it turns into this
/staticangularUtils-pagination/dirPagination

IndexError when pressed `alt+shift+right_mouse_click`

IndexError when pressed alt+shift+right_mouse_click

What is this happening when I press alt+shift+right_mouse_click?

Traceback (most recent call last):
  File "D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime_plugin.py", line 421, in on_post_text_command
    callback.on_post_text_command(v, name, args)
  File "QueryCompletionListener in D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\Data\Installed Packages\FuzzyFilePath.sublime-package", line 78, in on_post_text_command
  File "common.selection in D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\Data\Installed Packages\FuzzyFilePath.sublime-package", line 7, in get_line
  File "common.selection in D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\Data\Installed Packages\FuzzyFilePath.sublime-package", line 4, in get_position
  File "D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime.py", line 538, in __getitem__
    raise IndexError()
IndexError
Traceback (most recent call last):
  File "D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime_plugin.py", line 320, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "autofilename in D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\Data\Installed Packages\AutoFileName.sublime-package", line 171, in on_selection_modified_async
  File "D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime.py", line 538, in __getitem__
    raise IndexError()
IndexError
Traceback (most recent call last):
  File "D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime_plugin.py", line 320, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "autofilename in D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\Data\Installed Packages\AutoFileName.sublime-package", line 171, in on_selection_modified_async
  File "D:\User\Dropbox\Applications\SoftwareVersioning\SublimeText\sublime.py", line 538, in __getitem__
    raise IndexError()
IndexError

liamcain/AutoFileName#97

Not detecting new files

Newly created files are not detected automatically, I have to close and re-open Sublime 3, is there something I can do to fix this?

These are my custom settings:

{
  "additional_scopes": [
    {
      // es6 import from/import "*"
      "scope": "string.quoted.js",

      "auto": true,
      "relative": true,
      "base_directory": false,
      "prefix": ["from", "import"],
      "extensions": ["js", "html", "scss", "css", "png", "jpg"],
      "replace_on_insert": [
        ["\\.js$", ""],
        ["([^.])\\/index$", "\\1"],
        ["^([\\/.]+)?\\/(bower_components|node_modules)\\/", ""]
      ]
    },
  ]
}

And Sublime 3 settings:

{
	"auto_complete": true,
	"auto_complete_commit_on_tab": true,
	"auto_complete_triggers":
	[
		{
			"characters": "abcdefghijklmnopqrstuvwxyz",
			"selector": "string.quoted.js"
		}
	],
	"color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme",
	"dpi_scale": 1.4,
	"draw_centered": true,
	"ensure_newline_at_eof_on_save": true,
	"folder_exclude_patterns":
	[
		".bundle",
		".git",
		".sass-cache",
		"coverage",
		"tmp"
	],
	"font_options":
	[
		"directwrite",
		"gray_antialias",
		"subpixel_antialias"
	],
	"font_size": 10,
	"highlight_modified_tabs": true,
	"ignored_packages":
	[
		"JavaScriptEnhancements",
		"SublimeCodeIntel",
		"Vintage"
	],
	"material_theme_small_statusbar": true,
	"rulers":
	[
		79
	],
	"tab_size": 2,
	"theme": "Adaptive.sublime-theme",
	"translate_tabs_to_spaces": true,
	"trim_trailing_white_space_on_save": true
}
`` 

AttributeError: 'bool' object has no attribute 'replace'

I'm using Windows 10 64bit with Sublime 3.

When drag and drop a folder or a file into Sublime, the console prints:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 304, in on_activated
    callback.on_activated(v)
  File "ProjectListener in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 25, in on_activated
  File "ProjectListener in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 38, in on_project_activated
  File "project.ProjectManager in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 40, in activate_project
  File "project.ProjectManager in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 65, in get_project
  File "project.Project in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 28, in __init__
  File "project.Project in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 36, in update_settings
  File "project.Project in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 44, in evaluate_settings
  File "common.path in C:\Users\Clive\AppData\Roaming\Sublime Text 3\Installed Packages\FuzzyFilePath.sublime-package", line 14, in posix
AttributeError: 'bool' object has no attribute 'replace'

Insert path relative to the current file

Maybe due to I am a newbie to use this package, I did not find the way to insert the path of a file relative to the current file. I would like to ask this question, so the issue might be the best place for me to ask this question. Is it possible to do so?

To be more precise, see the following example:
Suppose I have the following directory structure:

.
+-- README.md
+-- src
|   +-- moduleA
|   |   +-- main.ccp
|   |   +-- a.lib
|   |   +-- ...
|   +-- moduleB
|   |   + fileA.cpp
|   |   + fileB.cpp
+-- others

When I work in the file main.cpp, I would like to insert the relative path to fileA.cpp. So I would like to insert ../moduleB/fileA.cpp into the file main.cpp.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.