Sublime Forum

PHP Autocomplete bug

#1

I’ve encountered an error where Sublime does something strange when it tries to autocomplete my code. If you paste the following code in an empty document, or somewhere, the php-tag in within the style-tag gets autocompleted in some strange way.

Running Dev Channel Build 3153 and 3154 on two different Win10 machines.

<?php 
function test() { ?>
	<div style="
			<?php echo ""; ?>
			">

It ends up like this:

<?php 
function test() { ?>
	<div style="
			<?php echo "?php echo "?php echo "?php echo ""; ?>
			">

Just by pasting. And if i try to remove the extra code added it just gets added back. And it’s even stranger if I try writing something on that line.

This is stripped down code from a real project I’m working on. The error only occurs if the function is there. And if it’s a style-property of the div, it’s not the same if I change it to class or something else.
Or if I switch from PHP syntax.

This also happens if I open existing files with code like that, the code gets changed on open.

0 Likes

#2

my understanding is that this is not an autocomplete bug, it’s a regression caused in the ST codebase when embed support was added for .sublime-syntax files - it changes the buffer in some circumstances when it really really shouldn’t. Something similar was reported for ASP here:

0 Likes