Skip to content

Commit 8ddfbee

Browse files
authored
fix: use standard-indent instead tab-width for indentation (#335)
I see the following warnings. ``` Warning: copilot--infer-indentation-offset found no mode-specific indentation offset, using ’tab-width’ instead. You can suppress this error message by customizing ’copilot-indent-warning-suppress’. ``` Reading the documentation comments for `tab-width` shows that it has no effect if spaces are used for indentation. ``` Documentation Distance between tab stops (for display of tab characters), in columns. This controls the width of a TAB character on display. The value should be a positive integer. Note that this variable doesn't necessarily affect the size of the indentation step. However, if the major mode's indentation facility inserts one or more TAB characters, this variable will affect the indentation step as well, even if indent-tabs-mode is non-nil. ``` If tabs are used, the `tab-width` is automatically adjusted, so there seems to be no need to worry about it. Conversely, `tabSize` is supposed to be the real tab size, not the indentation size, so put the value as it is.
1 parent 70ded8c commit 8ddfbee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

copilot.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ automatically, browse to %s." user-code verification-uri))
484484
(display-warning '(copilot copilot-no-mode-indent)
485485
"copilot--infer-indentation-offset found no mode-specific indentation offset.")
486486
(setq-local copilot--indent-warning-printed-p t))
487-
tab-width)))
487+
standard-indent)))
488488

489489
(defun copilot--get-relative-path ()
490490
"Get relative path to current buffer."
@@ -562,7 +562,7 @@ automatically, browse to %s." user-code verification-uri))
562562
(save-restriction
563563
(widen)
564564
(list :version copilot--doc-version
565-
:tabSize (copilot--infer-indentation-offset)
565+
:tabSize tab-width
566566
:indentSize (copilot--infer-indentation-offset)
567567
:insertSpaces (if indent-tabs-mode :json-false t)
568568
:path (buffer-file-name)

0 commit comments

Comments
 (0)