Sublime Forum

Display Functions (Java)

#9

[quote=“C0D312”]tretretre,

What OS are you using?
Can you check that you’re using the lastest version of Display-Functions?
And, if you don’t mind, could I see a sample of the code you were trying in on? (You can redact any info that you need to…)[/quote]

After looking at the example, I realize that I misunderstood the behavior (I thought that it would work when calling static methods without an instance).

I did however find some bugs when removing existing functions:
http://yay.nu/w6ROTY
http://yay.nu/nFmRa2

OS: Windows 7.

0 Likes

#10

Just pushed a fix to github.

The regex for getting the methods is now fixed (it won’t display ‘if’ or ‘return’ anymore). The plugin now removes any methods that were commented out.

@Tretretre, as for the second bug, did you “.” to trigger Display-Functions? It looks as if you triggered the default autocomplete w/ ctrl+space.

0 Likes

#11

No, it was triggered with “.”.

The last commit always have this behavior, even when methods exists.

0 Likes

#12

Hopefully all issues should be resolved.

If not, could you be more descriptive:

  • What is happening?
  • What’s the expected behavior?

BTW, opening an issue through Github is most likely faster and more efficient than posting a bug here on the forum.

0 Likes

#13

Thanks for the fix, works great now!

Found another bug, but I opened an issue on github this time (as well as sent a pull request with a fix).

0 Likes

#14

Ooh, if only this was for PHP :confused:

0 Likes

#15

UPDATE

  • Now supports “super.”
  • Now adds the methods of the parent class to the autocomplete

Please report any bugs or feature requests to the github page: https://github.com/BoundInCode/Display-Functions/issues

0 Likes

#16

Another big update.

  • Now lists the parameters.

  • Parameters come pre-highlighted for easy insertion.

Once again, please let me know if you have a feature request or found a bug.

0 Likes

#17

Can you add PHP support ? :wink:
Just replace the . by -> or ::

0 Likes

#18

[quote=“oxman”]Can you add PHP support ?
Just replace the . by -> or ::[/quote]

Maybe, but it will require a pretty big change. Mostly because Java is strictly typed and PHP is loosely typed. I’ll be working with PHP in the upcoming months, so we’ll see.

0 Likes

#19

[quote=“oxman”]Can you add PHP support ? :wink:
Just replace the . by -> or ::[/quote]

You want SublimeCodeIntel for PHP :smile:

0 Likes

#20

no because SCI need to parse/refresh all your codes, SCI is heavy…

0 Likes

#21

Awesome plugin. SL2 now more closed with an IDE :smile:, love it and thanks!

It could better if have pre-loaded default packages, classes from *.jar libraries.

0 Likes

#22

Hi! Is this plugin still being developed? I’m very interested in these functions, but I can’t get it to work in the latest versions of ST2. I suspect its the new autocomplete functionality in ST2 that breaks it. Anyone know how I can fix it?

0 Likes

#23

Sorry, I kinda lost track of maintaining this plugin for the past few updates. I’ll push a fix in a bit though. Thanks for the heads up.

0 Likes

#24

Should be fixed now. Let me know. If the functions aren’t popping up right away, though, press control+space.

0 Likes

#25

I’ve been using your plugin, but it isn’t putting the parameters into the function like it is supposed to. I’ve been looking through the code and I can’t figure out how you’re adding the parameters. Could you care to explain how your plugin is working?

0 Likes

#26

Well your plugin works fine for adding the parameters, but not when writing test classes. So I have a project set up with main and test packages and if I’m writing in the test class and I put a period, it says

Traceback (most recent call last): File ".\sublime_plugin.py", line 362, in run_ File ".\displayfunctions.py", line 34, in run File ".\displayfunctions.py", line 91, in get_obj_type File ".\displayfunctions.py", line 73, in get_return_type IOError: [Errno 2] No such file or directory: u'C:\\workspace\\testing\\src\\main\\java\\com\\thing\\thing2\\thing3\\String.java'

I subbed String in there for a real class name, but it happens no matter what.

I actually forgot to submit this comment, and now after about 3 hours I have figured out how to make this work while writing in test classes too. I don’t know how to make changes to stuff on github, so here you go, I added several lines to the make_filename function and I added another function to iterate through the folders.

[code]def make_filename(self, classname):
this_file = self.view.file_name()

    dir_len = this_file.rfind('/')  # (for OSX)

    if not dir_len > 0:
        dir_len = this_file.rfind('\\')  # (for Windows)

    this_dir = this_file:(dir_len + 1)]  # + 1 for the '/'

    this_dir = re.sub(r"\\test.*", r"\\main", this_dir) #added this to move back to main directory
         
    for i in self.locate(classname + ".java", this_dir): #added this to find the class in the directory
        this_dir = i
    return this_dir

def locate(self, pattern, file_path):
    '''Locate all files matching supplied filename pattern in and below
    supplied root directory.'''
    for (path, dirs, files) in os.walk(file_path):
        for filename in fnmatch.filter(files, pattern):
            yield os.path.join(path, filename)[/code]
0 Likes

#27

what’s Theme and Color scheme do you use? It looks wonderful and clearly!

0 Likes

#28

My colorscheme (a modified version of IR_Black)
I don’t remember what theme I was using in that screenshot. Currently I use Soda – Dark though.

0 Likes