Comments on: Éviter que Sublime Text n’écrase les parenthèses fermantes http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/ Deux développeurs en vadrouille qui se sortent les doigts du code Wed, 05 Feb 2014 12:15:31 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: Sam http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-15381 Sam Sun, 03 Nov 2013 06:19:34 +0000 http://sametmax.com/?p=7103#comment-15381 Pour ceux qui préfèrent la version de Groug, voici le code en entier (car sur SO il est tronqué): <pre> { "keys": ["\""], "command": "insert", "args": {"characters": "\""}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^\"]$", "match_all": true } ] }, { "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\"$", "match_all": true } ] }, { "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^(]$", "match_all": true } ] }, { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true } ] }, { "keys": ["'"], "command": "insert", "args": {"characters": "'"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^']$", "match_all": true } ] }, { "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "'$", "match_all": true } ] }, { "keys": ["]"], "command": "insert", "args": {"characters": "]"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^\\[]$", "match_all": true } ] }, { "keys": ["]"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true } ] }, { "keys": ["}"], "command": "insert", "args": {"characters": "}"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "[^\\{]$", "match_all": true } ] }, { "keys": ["}"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true } ] } </pre> Pour ceux qui préfèrent la version de Groug, voici le code en entier (car sur SO il est tronqué):

    { "keys": ["\""], "command": "insert", "args": {"characters": "\""}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "[^\"]$", "match_all": true }
        ]
    },
    { "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "\"$", "match_all": true }
        ]
    },

    { "keys": [")"], "command": "insert", "args": {"characters": ")"}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "[^(]$", "match_all": true }
        ]
    },
    { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true }
        ]
    },

    { "keys": ["'"], "command": "insert", "args": {"characters": "'"}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "[^']$", "match_all": true }
        ]
    },
    { "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "'$", "match_all": true }
        ]
    },

    { "keys": ["]"], "command": "insert", "args": {"characters": "]"}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "[^\\[]$", "match_all": true }
        ]
    },
    { "keys": ["]"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }
        ]
    },

    { "keys": ["}"], "command": "insert", "args": {"characters": "}"}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "[^\\{]$", "match_all": true }
        ]
    },
    { "keys": ["}"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }
        ]
    }
]]>
By: Sam http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-14456 Sam Tue, 01 Oct 2013 13:34:10 +0000 http://sametmax.com/?p=7103#comment-14456 :-) :-)

]]>
By: Duckie http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13853 Duckie Sun, 01 Sep 2013 23:25:43 +0000 http://sametmax.com/?p=7103#comment-13853 vim c'est kiffant mais sur windows c'est crado, autant utiliser Sublime dans ce cas faute de taffer sous un Unix. Les gars vous m'avez plié de rire avec le trombone à côté des commentaires. vim c’est kiffant mais sur windows c’est crado, autant utiliser Sublime dans ce cas faute de taffer sous un Unix.

Les gars vous m’avez plié de rire avec le trombone à côté des commentaires.

]]>
By: groug http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13364 groug Thu, 15 Aug 2013 17:16:47 +0000 http://sametmax.com/?p=7103#comment-13364 Sur SO, quelqu'un a posé la même question, et a une solution un chouia mieux que celle de Sam : même comportement, mais le caractère fermant reste remplacé si le caractère précédent est le caractère ouvrant : <a href="http://stackoverflow.com/questions/14032041/how-to-prevent-sublime-text-2-from-swallowing-closing-brackets-quotes-and-paren?lq=1" rel="nofollow">Lien SO</a> Sur SO, quelqu’un a posé la même question, et a une solution un chouia mieux que celle de Sam : même comportement, mais le caractère fermant reste remplacé si le caractère précédent est le caractère ouvrant :
Lien SO

]]>
By: groug http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13363 groug Thu, 15 Aug 2013 16:58:57 +0000 http://sametmax.com/?p=7103#comment-13363 Mouais, après quelques heures d'utilisation, j'ai un nouveau problème. Maintenant, quand je tape une balise ouvrante, que je tape du code puis tape la balise fermante, ça m'en rajoute une deuxième (normal, en fait), et je me retrouve à avoir un nouveau problème là où je n'en avais pas pour en corriger un autre. Du coup, à moins de désactiver l'ajout automatique de balise fermante, c'est choisir entre la peste et le choléra. La peste pour la création d'une ligne de code, le choléra pour la modification de cette ligne. Mouais, après quelques heures d’utilisation, j’ai un nouveau problème.
Maintenant, quand je tape une balise ouvrante, que je tape du code puis tape la balise fermante, ça m’en rajoute une deuxième (normal, en fait), et je me retrouve à avoir un nouveau problème là où je n’en avais pas pour en corriger un autre.
Du coup, à moins de désactiver l’ajout automatique de balise fermante, c’est choisir entre la peste et le choléra.
La peste pour la création d’une ligne de code, le choléra pour la modification de cette ligne.

]]>
By: cendrieR http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13357 cendrieR Thu, 15 Aug 2013 12:12:55 +0000 http://sametmax.com/?p=7103#comment-13357 Merci ! Merci !

]]>
By: jean roger http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13355 jean roger Thu, 15 Aug 2013 11:33:49 +0000 http://sametmax.com/?p=7103#comment-13355 <span class="troll"></span>Sinon, pour les champions, ya vim. Sinon, pour les champions, ya vim.

]]>
By: Fred http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13350 Fred Thu, 15 Aug 2013 09:13:48 +0000 http://sametmax.com/?p=7103#comment-13350 Bon je ne connais pas ST. Perso j'utilise vi sous Unix et notepad++ sous zindow. Mais je me dépêche en ce moment même d'aller combler cette lacune. Ceci dit, moi non plus je n'apprécie pas qu'un outil se permette de réfléchir à ma place. Surtout qu'il existe des cas particuliers où on met des parenthèses non pairées (par exemple dans le case...esac du shell). Merci donc de ces infos que je lis avidement ;) Bon je ne connais pas ST. Perso j’utilise vi sous Unix et notepad++ sous zindow. Mais je me dépêche en ce moment même d’aller combler cette lacune.
Ceci dit, moi non plus je n’apprécie pas qu’un outil se permette de réfléchir à ma place. Surtout qu’il existe des cas particuliers où on met des parenthèses non pairées (par exemple dans le case…esac du shell).

Merci donc de ces infos que je lis avidement ;)

]]>
By: viki53 http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13336 viki53 Wed, 14 Aug 2013 20:00:25 +0000 http://sametmax.com/?p=7103#comment-13336 Fuck yeah! Je t'aime, Sam, mon sauveur ! Plus sérieusement, ST commençait à me les hacher menu à la longue... Fuck yeah!

Je t’aime, Sam, mon sauveur !

Plus sérieusement, ST commençait à me les hacher menu à la longue…

]]>
By: groug http://sametmax.com/eviter-que-sublime-text-necrase-les-parentheses-fermantes/#comment-13335 groug Wed, 14 Aug 2013 19:51:21 +0000 http://sametmax.com/?p=7103#comment-13335 Je n'ai jamais pris le temps de chercher une solution, mais ça m'agace suffisamment pour venir poster un commentaire de remerciements ! Et heureusement que SublimeLinter est là pour raler, sinon, bien souvent, je m'en apercevrais qu'à l'exécution... Je n’ai jamais pris le temps de chercher une solution, mais ça m’agace suffisamment pour venir poster un commentaire de remerciements !
Et heureusement que SublimeLinter est là pour raler, sinon, bien souvent, je m’en apercevrais qu’à l’exécution…

]]>