Git Product home page Git Product logo

php-foldexpr.vim's People

Contributors

mikedfunk avatar swekaj 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

Watchers

 avatar  avatar  avatar

php-foldexpr.vim's Issues

folding limited to a single window in a vim split window session of the same *.php file

@swekaj , first, thanks for the plugin. Been using it for several weeks now and for the most part has been working well.

One area where it has not worked is when I open the same *.php file in a vim split window in order to examine two areas of the same file at the same time. The first window has the folds working just fine but the second window opens without any folds at all. Whenever I attempt to fold (zc) any function / method in that second window... I simply am told that there are no folds, whereas in the original window all the folds function as normal.

Do you see this as well?

Is there a way to disable certain folding: { blocks } and [blocks] ?

While these are useful, I often find they're a bit of overkill, esp. if a function has lots of if {} logic in it, I spend a lot of time opening folds (I know about zO)?

Is there an option to only fold classes, methods, functions, but not the lower level stuff?

Brilliant plug in anyway, thanks.

Configuration not being applied

I added the following configuration variables to my .vimrc:

let b:phpfold_text_right_lines=1
let b:phpfold_text_percent = 0
let b:phpfold_doc_with_funcs=0        
let b:phpfold_docblocks=1
+--   12 lines: public __construct() {...} - StylesController constructor.-----------------------------------------------------------------------------------------------
  4 
  3 
  2 +--  190 lines: public index() {...}-------------------------------------------------------------------------------------------------------------------------------------
  1 
227 +--   34 lines: public show() {...} - Display the specified resource.----------------------------------------------------------------------------------------------------
  1 
  2 +--   27 lines: public updateSingleStyleSizingChart() {...}--------------------------------------------------------------------------------------------------------------
  3 
  4 +--   27 lines: public updateSingleSizingChartException() {...}----------------------------------------------------------------------------------------------------------
  5 
  6 +--   47 lines: public updateMultiSizingChartExceptions() {...}-----------

I don't seem to see the right-alignment and the default behavior of the function + doc folding seems to be persist even if I set the doc_with_func to false.

I'm using the following version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 14 2018 14:26:22)
Included patches: 1-1605

Performance problem on indenting in large file

Profile info

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
186694 132.447726  45.251909  GetPhpFold()
166864  87.179004             FindPrevClassFunc()
   13   4.674672   0.002486  <SNR>86_UpdateErrors()
   13   3.091846   0.008128  <SNR>86_CacheErrors()
FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
166864             87.179004  FindPrevClassFunc()
186694 132.447726  45.251909  GetPhpFold()
   13   0.777582   0.767910  98()
   13   0.693651   0.685620  99()

DocBlocks don't fold with only {@inheritDoc}

When a DocBlock only contains {@inheritDoc} as the summary, or anything else without a ., it doesn't display in the best manner.
e.g.

<?php

class foo extends bar
{
    /**
     * {@inheritDoc}
     */
    public function func()
    {
        // code
    }
}

Should fold to

<?php

class foo extends bar
{
+-- 7 lines: public selectQueue() {...} - {@inheritDoc}-----
}

Not all /* */ comments are folded

For some reason, not all /*...*/ comments are being folded. Looks like it's only blocks with a { or } in them. The checks for { and } should probably be made a bit smarter to detect if it's inside a string or comment.

Fold HEREDOCs and NOWDOCs

Just realized I forgot to implement folding for HEREDOCs and NOWDOCs.

Probably open folds on the pattern /<<<\w+/ and close on /^\w+;$/

Fold not closed on certain multi line arrays

The following:

<?php
$a = Array(
  1,
  2,
  3,
  4, );

$this_should_not_fold = [];

folds to:

$a = Array(...];------------    7 lines +-

i.e. the fold is too greedy; the end of the array is not noticed.

protected methods not matched.

This is a simple one. The regex includes private twice, but I suspect one should be protected.

" handle class methods and independent functions
    if line =~? '\v\s*(abstract\s+|public\s+|private\s+|static\s+|private\s+)*function\s+(\k|\()' && line !~? ';$'

Indicator on right, how much lines are folded in a fold.

Currently I have this code in my vimrc: http://www.gregsexton.org/2011/03/improving-the-text-displayed-in-a-fold/

And there are many variants of lines-of-code indicators. I like it, it gives you a better view how much it's folded.

Except for PHP files. Then I use your plugin, but I'm not able to see how much is folded. It's bothering me. So I was wondering if there is any chance to integrate this in your awesome plugin, like "'44 lines of code" '

Thanks in advance for your reply.

folding mixed php+html files

Hi,
I was looking into getting folding for php files that are mixed with html, but apparently it's not getting right? See below.

Perhaps I am missing any specific configuration?
Thanks in advance

Expanded:
image

Folded:
image

Disable autofolding of class?

I would like to have extra variable, namely to disable auto-folding of class. In that way the functions inside the class will be folded automatically when I open the file, but the class-tag will not be folded.

Is that possible?

Edit: nevermind, I was wrong.

Fold method chaining

Add an option for folding method chains. The foldtext should display the chain as if it's on one line.

function let(Config $config)
{
    $config
        ->get('.buildable')
        ->willReturn('value');
}

Should fold into

function let(Config $config)
{
 +--- 3 lines: $config->get(...)->willReturn(...)-----------------------------
}

Comment text display bugs

When there is no period (.) on the first or second lines, the * isn't stripped from the first line.

The second lines should not be included if it starts with a tag (* @something).

Extremely Impressed and Thank you

I don't have any bug to report or enhancement to offer, but just wanted to let you know that I am extremely impressed with your vim addon.

Thank you very much for releasing this addon.

Plugin not working

I am using vim-plug. I followed the instructions for installing, and :PlugInstall shows that php-foldexpr is installed. However when I open a php file in vim. There is no code folding with zR zr za za, etc.

:verbose let b:phpfold_use yields "variable undefined" and php-foldexpr shows up in :scriptnames
The script acts as if it is not loaded automatically when I open a php file.

[] passed to method confused folding

There appears to be a bug when there's a ([ ]) fold.

 function let(Config $config)
 {
     $config
         ->get(strtolower($this->module).'.buildable')
         ->willReturn([
             $this->classname,
             []
         ]);
     $config
         ->get(strtolower($this->nonexistentModule).'.buildable')
         ->willReturn([
             $this->nonexistantClassname,
             []
         ]);
     $config
         ->get(strtolower($this->moduleWithGoodConstruct).'.buildable')
         ->willReturn([
             $this->moduleWithGoodConstructClassname,
             [
                 'arg1',
                 'named' => 'arg'
             ]
         ]);
     $config
         ->get(strtolower($this->moduleWithBadConstruct).'.buildable')
         ->willReturn([
             $this->moduleWithBadConstructClassname,
             'badConstruct'
         ]);
     $this->beConstructedWith($config);
 }

resulted in

     function let(Config $config)
     {
         $config
             ->get(strtolower($this->module).'.buildable')
 +--- 27 lines:  ->willReturn([...}-----------------------------

Fold only /** */, not /* */

/* */ are usually used to comment out sections of code, whereas /** */ are usually DocBlocks. Only fold DocBlocks.

Not displayed methods names

Methods folded correct, names of methods not displayed:

30 class Zend_Locale
31 {
...

  • 1051 +-- 8 lines folded
  • 1059 +-- 7 lines folded
  • 1066 +-- 7 lines folded
  • 1073 +-- 7 lines folded
  • 1080 +-- 7 lines folded
  • 1087 +-- 7 lines folded
  • 1094 +-- 7 lines folded
  • 1101 +-- 18 lines folded
  • 1119 +-- 10 lines folded
  • 1129 +-- 10 lines folded
  • 1139 +-- 11 lines folded
  • 1150 +-- 25 lines folded
  • 1175 +-- 45 lines folded
  • 1220 +-- 59 lines folded
  • 1279 +-- 65 lines folded
  • 1344 +-- 34 lines folded
  • 1378 +-- 11 lines folded
  • 1389 +-- 15 lines folded
  • 1404 +-- 33 lines folded
  • 1437 +-- 15 lines folded
  • 1452 +-- 22 lines folded
  • 1474 +-- 13 lines folded
  • 1487 +-- 13 lines folded
  • 1500 +-- 13 lines folded
  • 1513 +-- 14 lines folded
  • 1527 +-- 21 lines folded
  • 1548 +-- 14 lines folded
  • 1562 +-- 14 lines folded
  • 1576 +-- 14 lines folded
  • 1590 +-- 15 lines folded
  • 1605 +-- 23 lines folded
  • 1628 +-- 44 lines folded
  • 1672 +-- 58 lines folded
  • 1730 +-- 40 lines folded
  • 1770 +-- 16 lines folded
  • 1786 +-- 17 lines folded
  • 1803 +-- 11 lines folded
  • 1814 +-- 12 lines folded
  • 1826 +-- 11 lines folded
  • 1837 +-- 11 lines folded
  • 1848 +-- 12 lines folded
  • 1860 +-- 12 lines folded
  • 1872 +-- 76 lines folded
  • 1948 +-- 31 lines folded
    }

Create a foldtext() function

Some of the folds don't provide useful information when folded (e.g. /** */ comments just display +---- 5 lines: *------------. Write a function for fold-text to handle this better.

See :help foldtext() and :help fold-text

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.