-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beautify selection as another language #1202
Comments
Could you also provide a tiny code sample? It will give us something to test against. |
Sure, here are two made up examples where I'd like to be able to beautify the SQL within the other code. Perlmy $sql = <<'SQL';
SELECT fname, lname
FROM people
WHERE id >= ? AND id < ?
SQL
my $sth = $dbh->prepare($sql);
$sth->execute(1, 10);
while (my @row = $sth->fetchrow_array) {
print "fname: $row[0] lname: $row[1]\n";
} Gopackage main
import (
"database/sql"
"log"
_ "github.com/go-sql-driver/mysql"
)
func main() {
var (
id int
name string
)
db, err := sql.Open("mysql",
"user:password@tcp(127.0.0.1:3306)/hello")
if err != nil {
log.Fatal(err)
}
defer db.Close()
sql := `
SELECT id,
name
FROM "user"
WHERE name='Bob'
AND date='2014-01-10'
`
rows, err := db.Query(sql)
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
err := rows.Scan(&id, &name)
if err != nil {
log.Fatal(err)
}
log.Println(id, name)
}
err = rows.Err()
if err != nil {
log.Fatal(err)
}
} |
Perhaps a right click option Beautify As... that open a list of grammars. |
Closing as duplicate of #27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As far as I can tell, there is no way to currently beautify a selection of code in a specific language that is different than the file's language. My primary use case for this feature would be beautifying SQL that is embedded in string literals, although I imagine it could also be useful for beautifying other embedded code or markup.
The text was updated successfully, but these errors were encountered: