Giter Club home page Giter Club logo

sublimetext-syntaxfold's People

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

Watchers

 avatar  avatar  avatar

sublimetext-syntaxfold's Issues

Only Command Palette commands work

All the keybinds used to work perfectly. For whatever unknown reason they stopped working and now the folding only works by using the Command Palette.

Any solutions for this problem?

Cannot use these characters as start/end markers.

I can not use "[" and "]" as start and end regions for folding areas.

SyntaxFold settings:
{ "scope": "text.plain", "startMarker":"[", "endMarker":"]" }

I can use <>, {}, but not [], and also not ().
I'd like to know why this is the case.

In the *--#[ and *--#] region markers not working issue, it's said that special characters must be escaped, however, when i do so, the console shows me the following:
error: Error trying to parse settings: Invalid escape in Packages\User\syntax_fold.sublime-settings:25:27

Fold all not working

I have the toggle and unfold commands working fine, but fold all doesn't seem to work at all. I noted that in the status bar a message appears saying '1 regions folded' but no code is folded at all. I have tried with different key bindings but it doesn't work. I am on OS X in ST4. Thanks for any advice.

[Feature Request] Toggle Folding

Hi,

I am using your Plugin and it works really well. It would be nice to have a toggle folding command, so one has to rememeber only a single keyboard shortcut.

does absolutely nothing

Hello,

I tried folding html and js, nothing happens

sometimes doing alt+0 or alt+1 switch the current edited document to another one, but appart from that

my code is never altered

waht am I missing ?

thanks

feature_request(enhancement): single line folding

1. Summary

It would be nice, if Sublime Text SyntaxFold will support folding text in single line.

2. Argumentation

I use Sublime Text TableEditor plugin for tables creating. Example table:

Normal table

I can have a long text in a cell.

Big monitor:

Big monitor

Small monitor โ€” bad table:

Small monitor

I want fold text, if line length in a cell is long. But I can't do it.

3. Configuration

User/syntax_fold.sublime-settings:

{
    "config":
    [
        {
            "scope": "text.genius.kira",
            "startMarker": "!fold",
            "endMarker": "!end"
        }
    ]
}

Demo__SyntaxFold--Kireopardy.kira:

Example table

Parts of Demo__SyntaxFold--Kireopardy.kira:

!fold Sasha Best !end
!fold
   Sasha Leader
!end

4. Steps to reproduce

I run fold_all command (Alt+0, Alt+0).

5. Expected behavior

Multiline and single-line texts fold:

Expected

6. Actual behavior

Multiline text fold, single-line not:

Actual

Thanks.

Bug: undefined variable for name Default

So in SyntaxFold.py:

class FoldPanelCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.panel_cache = []
        self.config_map = {}
        s = sublime.load_settings('syntax_fold.sublime-settings')
        configs = s.get("config")
        for conf in configs:
            c=dict()
            c['startMarker']=conf.get('startMarker')
            c['endMarker']=conf.get('endMarker')
            if conf['name']=="Default":
                descr=startMarker <--------------------------------------------------

this value is not defined
console says the same
NameError: global name 'startMarker' is not defined

Cheers

Nested folds

I don't think it works but I might be missing somethng: So, like:

//region
some stuff
//region
other suff
//endregion
more stuff
//endregion

Issue : "Bookmark" Artifacts

This is an awesome plugin : )

However, I am currently running into the following issue:

After folding & unfolding the code several times, I am left with multiple artifacts of "bookmark" symbols in the left gutter. Is there a way to disable bookmarks from SyntaxFold entirely? I do not see a use for them, as regular code fold symbols should be all that is needed, & the bookmark symbols obscure them.

screenshot_030315_060526_pm

Can't make folding work

Hi,
Looks like the folding is not working for me.
I'm trying to make it work for python (*.py) files and I want the startMarker to be literal text #;{ and endMarker to be literal text #;}. Note that # is the start of a comment in python.

So in Preferences > Package Settings > SyntaxFold > Settings - User I tried to add

,
        {
            "scope": "python.py",
            "startMarker": "#;{",
            "endMarker": "#;}"
        }

and I also tried without the scope line - the folding still doesn't work for me.
What am I doing wrong and how to achieve what I want?

Feature Request: Automatically Fold all Regions in 1 Line in a Box with Name ( even Sub-Regions )

Hi. :)

I wondered if you can make everything between "#region" and "#endregion", including "#region" and "#endregion" in a box, when folded ( nothing outside ). When unfolded the name after "#region" is in a box too, with the name ( even when unfolded ). Clicking the box unfolds and folds the region. :)

I've noticed that regions inside regions are not folded. Can this be solved? :)

Another idea is that everything is folded by default ( no need to save states ). Even when copying code into Sublime Text, the regions automatically folds.

An additional thing would be an arrow to the left ( like with "{" and "}" ), if possible. :)

I hope this is something that can be implemented.

Best regards,
Johannes Hillestad Baumann

Does this work in Sublime Text 3?

I've just installed in Sublime Text 3 - and attempted to get it working with C# style regions in JavaScript:

//#region Test
 CODE
//#endregion

using the following config:

{
   "endMarker": "//#endregion",
   "name": "JavaScript #region",
   "startMarker": "//#region"
}

But I can't seem to get the plugin to do anything?

[feature] folder sign keeping when unfolding is executed.

Hi, I notice that when I fold all the regions, the triangle folder sign will appear on the specific position. This is great, but the problem is that when I unfold single region by clicking the triangle, the original sign will disappear. Can you still keep the triangle unfold sign when I do unfold operation?

Thank you!

No start or end markers found

Tried this on a javascript and php files but nothing happens.
and this appears on the console:

SyntaxFold: No start markers or end markers found in file. Aborting request.

Although my file does contain start and end markers
I didn't touch any setting the first time , then i separated javascript:

        {
            "scope": "source.js",
            "startMarker":"{region",
            "endMarker":"}endregion"
        }

but that didn't work as well.
Am i missing something here or is it a bug ?

How to set custom syntax

Not quite clear how to use this.
I want to fold knitr markdown code chunks
I tried putting this in Packages/User/syntax_fold.sublime_settings but I don't get offered knitr as an option when I press shift F5. What do I need to add?

"knitr":
    {
        "endMarker": "```$",
        "name": "Knitr",
        "startMarker": "```\\{r(.*)\\}"
    }

Folding HTML?

Does this plugin handle folding of HTML code? Or, do I need to configure that in the settings?

Feature: Toggle Current Fold

It'd be nice to have a single shortcut/keybind to toggle the fold rather than two separate keybinds for opening/closing specifically. If it's unfolded then fold it, if it's folded then unfold it.

[Feature Request] nested Regions

First of all: Thanks for your plugin! It is great if you ever worked with Visual Studio.

Is there a way to support for defining regions inside regions:

sl_folding

CSS regions

how can i fold region with "startMarker": "/*region*/" and "endMarker": "/*endregion*/"
Is this possible at all? because i can't make this working :(

Doesn't seem to work in SublimeText 4

Greetings!

I hope this finds you well. Having gone along with the recent ST4 update, I believe SyntaxFold might need an update to function. When ya go to fold all the code, it folds it according to ST's syntax. I've tried resinstalling, etc., doesn't seem to help. Thanks in advance for you time and consideration. Cheers!

Code folding not including trailing whitespace

My specific scenario is in Javascript with a multiline template string.

{
    "scope": "source.js",
    "startMarker": "query = `",
    "endMarker": "`"
}

this causes a line like this:

function someFunc() {
  let query = `
    SELECT foo
    FROM bar
  `;
}

to look like this (code folding character omitted):

function someFunc() {
  let query = `
  `;
}

I was expecting it to look like this (code folding character omitted):

function someFunc() {
  let query = ``;
}

2.0.0 just updated doesn't work

I am using c# coding.
This plugins suddenly stopped working on this previous update, but I tried it a lot working now.
//syntax_fold.sublime-settings
{
"endMarker": "#endregion",
"name": "C#",
"scope": "source.cs", <-- Add line
"startMarker": "#region"
},
I hope this will help:)

Nothing happens when i do "alt+*anything*"

Hello all,
i downloaded this plugin today for sublimtext3 & install it but after that when i whrite
#pragma region enum WeekDay { Dimanche,Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi }; #pragma endregion
and did "alt+1", but nothing happened...
did i do something wrong ?
Thx !!

toggle_fold_current minor annoyance

current block will not "unfold" if cursor is located within start marker line. It must be positioned at the end.

# region First Region...
------------^ (cursor position) will not unfold

# region First Region...
-----------------------^ (cursor position) works

Mac OS X (High Sierra version 10.13.6), Sublime 3.1.1 Build 3176

Fold to end of file

Is it possible to fold from a startMarker to the end of the file?
eg. With "startMarker" = "##" and no "endMarker" defined:

## Section 1
This is foldable
## Section 2
This is not foldable

Thanks for the plugin.

Syntaxfold aborts when one entry has no start or end markers.

As part of code introduced with PR #39 the functionality was added to:

Adding ability to specify different regions within the same source code type.

When one of these regions report 0 matches for both the start and end markers, the fold aborts even if there is other legitimate matches in other regions.

Java-like comment support

Hi there,

I'm trying to get support for COD - using a syntax like below. Any thoughts ... I don't know if it will work because the start and end tags are formatted as comments by the syntax highlighter.

Any help would be great. Cheers.

/***
@Class QueryRequest
***/
public class QueryRequest {

/***
@Property BaseObject
@type String
@summary Stores the name of the base object of the query request.
***/
public String BaseObject { get; set; }
}

Add Another Config not working properly under Mac

OS: Mac OS X 10.10.2
Using the Menu Option "Add Another Config" creates a File Named "Packages\User\syntax_fold.sublime-settings" instead of creating the file "syntax_fold.sublime-settings" in the Folder "Packages\User".

[Feature Request] save folding state

It is possible to save the state of folding regions when closing a file to load it again when reopening the file again.

The shortcuts [ALT]+[0] and [ALT]+[SHIFT]+[0] are known to me, but somtimes i had some regions folded others dont folded.

The informations of the folding states could be stored in the fileheader itself (like Vims modeline see here) or as dotfile inside the directory of the file.
Ideally changeable via User-Settings of SyntaxFold.

TypeError: String required

master from today (commit:5dbc247), Sublime Text 3 build 4169, OSX 14.4.1.

the default settings have been pared down to an empty file, and the user settings only have one entry now:

{
    "config":[
        {
            "scope": "source.c++, source.c",
            "startMarker": [ "#pragma region", "#ifdef", "#ifndef", "#if" ],
            "endMarker": [ "#pragma endregion", "#endif", "#else", "#elif" ],
        },
    ]
}

The test C file I have created:

#if foo
void some_func(void)
{
	do_the_thing();
}
#endif

If I check the scope I see source.c meta.preprocessor.c which should match the scope in the user settings above.

Doesn't matter where I have the cursor (start, middle or end of #if foo, somewhere in the block, start or end of #endif), nothing happens. If I open the console, I see this:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1499, in run_
    return self.run(edit)
  File "/Users/andrew/Library/Application Support/Sublime Text 3/Packages/SyntaxFold/SyntaxFold.py", line 187, in run
    fold_regions = get_all_fold_regions(self.view)
  File "/Users/andrew/Library/Application Support/Sublime Text 3/Packages/SyntaxFold/SyntaxFold.py", line 98, in get_all_fold_regions
    start_positions, end_positions = get_all_positions(view,marker_pair)
  File "/Users/andrew/Library/Application Support/Sublime Text 3/Packages/SyntaxFold/SyntaxFold.py", line 67, in get_all_positions
    start_markers = view.find_all(start_marker)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime.py", line 1416, in find_all
    return sublime_api.view_find_all(self.view_id, pattern, flags)
TypeError: String required

I was getting an error about the .cs syntax folding which is why I cleared out the default settings file and focused on the user settings one.

Improvement: Reduce visible text when collapsed

When collapsing a "region" you shouldn't see the "//region" or "//endregion" anymore. You should just see a highlighted chunk of text. Not sure if this is possible or not, but it would be a big improvement and reduce the visible clutter when looking at a document with a ton of folded regions.

image

Pattern regions

Hello

Was trying to use syntaxfold for LaTeX but I am not sure if I am using it in the wrong way, or if it just doesn't work for what I want.

Basically, my config looks like:

        {
            "endMarker": "\\end{",
            "name": "LaTeX",
            "startMarker": "\\begin{"
        },

and as you might expect, marker lines continue with more characters up to the end of the line.

It seems it doesn't work with this kind of markers at the moment. I am right?

Also, does it have any problem with nested regions?

best,

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.