all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#61923: 30.0.50; go-ts-mode, multiline raw-string-literal wrong indentation
@ 2023-03-02 17:16 Gleb Zakharov
  2023-03-03  7:04 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Gleb Zakharov @ 2023-03-02 17:16 UTC (permalink / raw)
  To: 61923

Hi everyone,
thank you all for the hard work!

In Go, I sometimes work with code written in another language.
I embed it into Go as string literals, for example, SQL code.

When I type a multiline string, I notice that tree-sitter indents it by
usual Go rules, but this feature should be turned off inside the string.

How to reproduce the behavior with `emacs -Q`:

Paste a text from a snippet below, execute lines in the comments
to start `go-ts-mode` and
type M-q or M-x prog-fill-reindent-defun RET.
The text should stay as it is, but things in a multiline string
indented.

```
// (require 'treesit)
// (require 'go-ts-mode)
// (setq treesit-extra-load-path '("/home/snyssfx/.guix-home/profile/lib/tree-sitter"))
// (go-ts-mode)

func a() {
	_ = `
SELECT a
	FROM b
	WHERE c;
	
if true {
	panic("doesn't have to be indented")
}`
}

```

I tried to add
```
  ((node-is "raw-string-literal")
   point-min)
```
to `go-ts-mode--indent-rules`, but it doesn't seem to fix it.
The problem doesn't exist for just string literals, as they must not be multiline.

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 --prefix=/gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87
 --enable-fast-install --with-modules --with-cairo
 --with-native-compilation --disable-build-details'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: /home/snyssfx/.guix-home/profile/share/emacs/site-lisp:/home/snyssfx/.guix-home/profile/share/emacs/site-lisp:/gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Go

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/gnu/store/bswj8m0vr5pxxqz596wg1vw0l3vhap56-emacs-transient-20230219.1111/share/emacs/site-lisp/transient-20230219.1111/transient hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/transient
/gnu/store/nk42g92xzs9c0406xhkg7fq1iyijcn74-emacs-bind-key-20230203.2004/share/emacs/site-lisp/bind-key-20230203.2004/bind-key hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/bind-key
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-delight hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-delight
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-diminish hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-lint hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-lint
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-bind-key hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-jump hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-jump
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-ensure hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/gnu/store/zvamp8ayqg4867dc53mfk0ckjj277ryf-emacs-use-package-20230203.2004/share/emacs/site-lisp/use-package-20230203.2004/use-package-core hides /gnu/store/xa55f4sq86q91l59c5nwmhch75s82icp-emacs-next-29.0.60-0.ac7ec87/share/emacs/30.0.50/lisp/use-package/use-package-core

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date smerge-mode
diff-mode easy-mmode diff help-fns radix-tree cl-print byte-opt debug
backtrace find-func go-ts-mode treesit cl-loaddefs comp comp-cstr
warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp
byte-compile cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 97206 10432)
 (symbols 48 8202 0)
 (strings 32 23985 1962)
 (string-bytes 1 788970)
 (vectors 16 18947)
 (vector-slots 8 370311 8362)
 (floats 8 50 38)
 (intervals 56 629 0)
 (buffers 984 16))





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-11-26 16:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-02 17:16 bug#61923: 30.0.50; go-ts-mode, multiline raw-string-literal wrong indentation Gleb Zakharov
2023-03-03  7:04 ` Eli Zaretskii
     [not found]   ` <87fsam3wk7.fsf@posteo.net>
2023-03-03 11:38     ` Eli Zaretskii
2023-03-03 14:38       ` Gleb Zakharov
2023-03-03 11:39 ` Gleb Zakharov
2023-03-03 22:29 ` Yuan Fu
2023-03-03 23:50   ` Dmitry Gutov
2023-03-04  9:28     ` Yuan Fu
2023-03-04 17:39     ` Gleb Zakharov
2023-11-26 15:47       ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 16:37         ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.