Sublime Forum

ST3 adds unwanted characters by itself

#1

Greetings:

Sublime Text 3 has been adding unwanted curly brackets [ { } ] AND commas [ , ] all by itself.

I have watched ST3 repeatedly do this numerous times. I had to switch to another editor to accomplish work.

This is completely “off the wall” and I seem to be the only one since SEARCH did not show any results of people have similar problems.

I don’t want to relegate ST3 to second place, but what’s a guy to do?

TIA,

Dave, a licensed user

0 Likes

#2

Sublime does auto-pair several kinds of punctuation. You can disable this by setting "auto_match_enabled": False in your user preferences.

Can you give a concrete example of a situation in which Sublime inserts an unwanted comma?

1 Like

#3

@ThomSmith is correct - auto_match_enabled is one of the systems / configuration values which controls that behavior - and I find it annoying too… Adding quotes, etc… and then not always properly seeing when I add another ( in-line and when I type the next ) it replaces the one there meaning I end up with 2 (s and 1 )… it’s a poorly designed system which doesn’t take into account what’s been typed and it honestly needs some fixes - I may submit the issues to the issue tracker…

If you don’t like that system then the autocomplete is equally bad…

	"auto_complete_commit_on_tab": true,
	"auto_complete_cycle": true,
	"auto_complete_delay": 0,
	"auto_complete_selector": "meta.tag - punctuation.definition.tag.begin, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
	"auto_complete_triggers":
	[
		{
			"characters": "<",
			"selector": "text.html"
		}
	],
	"auto_complete_with_fields": true,

is my configuration for them - so Enter doesn’t add something in when I want a new line - although the trade-off is when I want to align code ( which happens less frequently than new lines ) tab will alter the variable because the system doesn’t take into account that I am trying to line up =s based on previous lines…

0 Likes

#4

The unexpected behavior occurred in my “single-program.php.” The following commas appeared out of nowhere:

<?php $relatedProfessors = new WP_Query(array( 'posts_per_page' => -1, 'post_type' => 'professor', 'orderby' => 'title', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'related_programs', 'compare' => 'LIKE', 'value' => '"' . get_the_ID() . '"' ) <- here ) <- and here )); also ... $today = date('Ymd'); $homepageEvents = new WP_Query(array( 'posts_per_page' => 2, 'post_type' => 'event', 'meta_key' => 'event_date', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'event_date', 'compare' => '>=', 'value' => $today, 'type' => 'numeric' ), array( 'key' => 'related_programs', 'compare' => 'LIKE', 'value' => '"' . get_the_ID() . '"' ) <- here ) <- and here )); the curly brackets { } appeared in my header, driving me nuts:
        <li <?php if (get_post_type() == 'program') echo 'class="current-menu-item"' ?>><a href="<?php echo get_post_type_archive_link('program'); ?>">Programs</a></li>
        <li <?php if (get_post_type() == 'event' OR is_page('past-events')) echo 'class="current-menu-item"' ?>><a href="<?php echo get_post_type_archive_link('event'); ?>">Events</a></li>
        <li <?php if (get_post_type() == 'campus') echo 'class="current-menu-item"' ?>><a href="<?php echo get_post_type_archive_link('campus'); ?>">Campuses</a></li>
        <li <?php if (get_post_type() == 'post') echo 'class="current-menu-item"' ?>><a href="<?php echo site_url('/blog'); ?>">Blog</a></li>
      </ul>

I believe the unwanted brackets appeared around the echo statements. I’ll make the adjustment to auto_match_enabled line …

Thanks for the input.

0 Likes