Closed festum closed 2 years ago
Woah. I've never seen anything like that before. I'm not sure what mechanism would even cause a loop like that: perhaps some interaction with auto-saving in vs code.
Needless to say, we'd really like to get to the bottom of this. If you could help us investigate it would be extremely helpful.
To start, are you able to capture rpc logs for a minimal repro? https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-gopls-information
BTW, when I initially read the issue, I thought you said "It happens since 0.8.4" (which is a recent gopls version), but you said It happens since 1.18.4, which is a recent go version. Are you sure this started happening when you updated Go? I would be very surprised if that were the case.
Could you also please share your vscode settings.json, and whether or not you have any other extensions installed that may format Go files?
Putting this in the v0.10.0 milestone as given more information we'd like to fix this bug expediently.
However, since we can't repro it will be very hard for us to fix this without more information.
The issue is gone after vscode v1.70. Can still reproduce in the older version.
collect-gopls-information
Ready! Initialized! open file:///home/festum/Repo/LeetCode-Go/leetcode/0778.Swim-in-Rising-Water/README.md create text checking session for "file:///home/festum/Repo/LeetCode-Go/leetcode/0778.Swim-in-Rising-Water/README.md" with { "documentDialect": "auto-text", "documentDomain": "general", "suggestions": { "ConjunctionAtStartOfSentence": false, "Fluency": true, "InformalPronounsAcademic": false, "MissingSpaces": true, "NounStrings": true, "NumbersBeginningSentences": true, "NumbersZeroThroughTen": true, "OxfordComma": false, "PassiveVoice": false, "PersonFirstLanguage": true, "PossiblyBiasedLanguageAgeRelated": true, "PossiblyBiasedLanguageDisabilityRelated": true, "PossiblyBiasedLanguageFamilyRelated": true, "PossiblyBiasedLanguageGenderRelated": true, "PossiblyBiasedLanguageHumanRights": true, "PossiblyBiasedLanguageHumanRightsRelated": true, "PossiblyBiasedLanguageLgbtqiaRelated": true, "PossiblyBiasedLanguageRaceEthnicityRelated": true, "PossiblyPoliticallyIncorrectLanguage": true, "PrepositionAtTheEndOfSentence": false, "PunctuationWithQuotation": true, "ReadabilityFillerwords": true, "ReadabilityTransforms": true, "SentenceVariety": true, "SpacesSurroundingSlash": true, "SplitInfinitive": true, "StylisticFragments": false, "UnnecessaryEllipses": false, "Variety": true, "Vocabulary": true } } ready file:///home/festum/Repo/LeetCode-Go/leetcode/0778.Swim-in-Rising-Water/README.md connecting file:///home/festum/Repo/LeetCode-Go/leetcode/0778.Swim-in-Rising-Water/README.md checking file:///home/festum/Repo/LeetCode-Go/leetcode/0778.Swim-in-Rising-Water/README.md idle file:///home/festum/Repo/LeetCode-Go/leetcode/0778.Swim-in-Rising-Water/README.md
VScode setting
{ "audioCues.lineHasError": "auto", "audioCues.volume": 2, "editor.experimental.useCustomCodeActionMenu": true, "editor.experimental.stickyScroll.enabled": true, "editor.acceptSuggestionOnEnter": "off", "editor.autoIndent": "brackets", "editor.codeActionsOnSave": { "source.sortImports": false, "source.organizeImports": true, }, "editor.autoClosingQuotes": "never", "editor.bracketPairColorization.enabled": true, "editor.bracketPairColorization.independentColorPoolPerBracketType": true, "editor.cursorBlinking": "smooth", "editor.detectIndentation": true, "editor.dragAndDrop": true, "editor.find.autoFindInSelection": "multiline", "editor.find.cursorMoveOnType": true, "editor.find.seedSearchStringFromSelection": "selection", "editor.fontFamily": "'FiraCode Nerd Font', 'Iosevka Term', 'Hasklug Nerd Font', Input, Consolas, 'Sarasa Term TC'", // www.nerdfonts.com/font-downloads "editor.fontLigatures": true, "editor.fontSize": 15, //17, "editor.fontWeight": "430", "editor.formatOnPaste": true, "editor.formatOnSave": false, "editor.formatOnSaveMode": "modificationsIfAvailable", "editor.formatOnType": true, "editor.guides.bracketPairs": true, "editor.guides.highlightActiveIndentation": true, "editor.guides.indentation": true, "editor.inlineSuggest.enabled": true, "editor.insertSpaces": false, "editor.lineHeight": 20, //16, "editor.matchBrackets": "near", "editor.minimap.renderCharacters": false, "editor.minimap.scale": 1, "editor.minimap.showSlider": "mouseover", "editor.minimap.size": "fit", "editor.mouseWheelScrollSensitivity": 1.2, "editor.mouseWheelZoom": false, "editor.multiCursorModifier": "ctrlCmd", "editor.occurrencesHighlight": true, "editor.parameterHints.enabled": true, "editor.quickSuggestions": { "other": true, "comments": true, "strings": true }, "editor.quickSuggestionsDelay": 1, "editor.renderWhitespace": "trailing", "editor.scrollbar.horizontalScrollbarSize": 8, "editor.scrollbar.verticalScrollbarSize": 15, "editor.selectionHighlight": true, "editor.semanticHighlighting.enabled": true, "editor.snippetSuggestions": "top", "editor.suggest.preview": true, "editor.suggestOnTriggerCharacters": true, "editor.suggestSelection": "recentlyUsedByPrefix", //first "editor.tabCompletion": "on", "editor.tabSize": 4, "editor.trimAutoWhitespace": true, "editor.useTabStops": false, "editor.wordBasedSuggestions": true, "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?", "editor.wordWrap": "on", "editor.wrappingIndent": "same", "explorer.autoReveal": false, "explorer.confirmDelete": false, "explorer.confirmDragAndDrop": false, "explorer.confirmUndo": "verbose", "explorer.decorations.badges": true, "explorer.decorations.colors": true, "explorer.enableDragAndDrop": true, "explorer.enableUndo": true, "explorer.fileNesting.enabled": true, "explorer.fileNesting.expand": false, "explorer.openEditors.visible": 5, "extensions.autoUpdate": true, "extensions.closeExtensionDetailsOnViewChange": false, "extensions.ignoreRecommendations": true, "window.commandCenter": true, "window.doubleClickIconToClose": true, "window.openFilesInNewWindow": "off", "window.restoreWindows": "preserve", "window.titleBarStyle": "custom", "workbench.colorCustomizations": {}, "workbench.colorTheme": "poimandres-storm", "workbench.preferredLightColorTheme": "Eva Light", "workbench.preferredDarkColorTheme": "poimandres-storm", "workbench.preferredHighContrastColorTheme": "August - Radical 2", "workbench.activityBar.visible": false, "workbench.editor.decorations.badges": true, "workbench.editor.decorations.colors": true, "workbench.editor.defaultBinaryEditor": "default", "workbench.editor.enablePreview": true, "workbench.editor.highlightModifiedTabs": true, "workbench.editor.historyBasedLanguageDetection": true, "workbench.editor.preferHistoryBasedLanguageDetection": true, "workbench.editor.openPositioning": "last", "workbench.editor.pinnedTabSizing": "compact", "workbench.editor.scrollToSwitchTabs": false, "workbench.editor.showTabs": true, "workbench.editor.tabCloseButton": "off", "workbench.editor.tabSizing": "shrink", "workbench.editor.untitled.hint": "hidden", "workbench.editorAssociations": { "*.ipynb": "jupyter-notebook" }, "workbench.editor.splitOnDragAndDrop": true, "workbench.iconTheme": "material-icon-theme", "workbench.list.smoothScrolling": true, "workbench.quickOpen.preserveInput": true, "workbench.settings.editor": "json", "workbench.startupEditor": "none", //"C:\\WINDOWS\\Sysnative\\bash.exe", "workbench.tips.enabled": true, "terminal.external.osxExec": "Alacritty.app", "terminal.external.windowsExec": "C:\\fe0\\bin\\Cmder\\Cmder.exe", "terminal.integrated.scrollback": 20000, "terminal.integrated.shellIntegration.enabled": true, "terminal.integrated.shellIntegration.history": 20000, "terminal.integrated.splitCwd": "inherited", "terminal.integrated.showLinkHover": false, "terminal.integrated.fontSize": 14, "terminal.integrated.fontFamily": "'FiraCode Nerd Font', Consolas, Input, 'Courier New', 'Sarasa Term TC'", // https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration "terminal.integrated.cursorBlinking": true, "terminal.integrated.cursorStyle": "line", "terminal.integrated.tabs.title": "${process} - ${cwd}", "terminal.integrated.rightClickBehavior": "copyPaste", "terminal.integrated.localEchoStyle": "#fff000", "terminal.integrated.wordSeparators": " ()[]{}',\"`─;&&", "terminal.integrated.defaultLocation": "view", "terminal.integrated.env.linux": {}, "task.autoDetect": "off", "telemetry.telemetryLevel": "off", "remoteHub.uncommittedChangesOnEntry": "promptIfBehind", "files.autoSave": "off", "files.encoding": "utf8", "files.eol": "\n", "files.insertFinalNewline": true, "files.trimFinalNewlines": false, "files.trimTrailingWhitespace": true, "files.associations": { "tslint.json": "jsonc" }, "notebook.outline.showCodeCells": true, "notebook.breadcrumbs.showCodeCells": true, "notebook.cellToolbarLocation": { "default": "right", "jupyter-notebook": "left" }, "scm.alwaysShowRepositories": false, "scm.diffDecorationsIgnoreTrimWhitespace": "true", "scm.defaultViewSortKey": "status", "git.autoRepositoryDetection": true, "git.autofetch": true, "git.branchProtection": ["master", "main"], "git.confirmSync": false, "git.enabled": true, "git.ignoreRebaseWarning": true, "git.ignoreSubmodules": true, "git.mergeEditor": true, "git.path": "git.exe", "git.pruneOnFetch": true, "git.repositoryScanMaxDepth": 1, "gitlens.blame.highlight.locations": [ "gutter", "overview", "line", ], "gitlens.codeLens.authors.command": false, "gitlens.codeLens.scopes": [ "blocks", ], "gitlens.currentLine.scrollable": false, "gitlens.defaultDateFormat": "YYYY-MM-DD HH:mm:ss", "gitlens.defaultDateShortFormat": "YYYY-MM-DD", "gitlens.defaultTimeFormat": "HH:mm:ss", "gitlens.hovers.currentLine.over": "line", "gitlens.keymap": "none", "gitlens.statusBar.reduceFlicker": true, "gitlens.views.formats.commits.label": "${(tips)➤ }${message}", "gitlens.views.stashes.files.layout": "list", "problems.showCurrentInStatus": true, "security.workspace.trust.enabled": false, "update.mode": "manual", "files.exclude": { "**/*.*-cache": true, "**/*.*-dist": true, "**/*.*build*": true, "**/*.class": true, "**/*.com": true, "**/*.dll": true, "**/*.exe": true, "**/*.log": true, "**/*.o": true, "**/*.pyc": true, "**/*.so": true, "**/*.sqlite": true, "**/*.sublime-*": true, "**/.DS_Store": true, "**/.Trashes": true, "**/._*": true, "**/.cache": true, "**/.classpath": true, "**/.factorypath": true, "**/.git": true, "**/.hg": true, "**/.idea": true, "**/.project": true, "**/.pytest_cache": true, "**/.settings": true, "**/.svn": true, "**/.vscode": true, "**/CVS": true, "**/Thumbs.db": true, "**/__pycache__": true, "**/_site": true, "**/bin": true, "**/bower_components": true, "**/node_modules": true, "**/pkg": true, "**/tmp": true, "**/venv": true, // "**/.env": true, // "**/*.sql": true, }, "files.watcherExclude": { "**/.git/objects/**": true, "**/.git/subtree-cache/**": true, "**/node_modules/**": true, "**/*env*/**": true, "**/*.*-dist": true, "**/*.*build*": true, }, "search.mode": "reuseEditor", "search.exclude": { "**/*.*build*": true, "**/.git": true, "**/bower_components": true, "**/node_modules": true, "**/pkg": true, "**/tmp": true, "**/*env*/**": true, }, "activitusbar.views": [ { "name": "explorer", "codicon": "repo" }, { "name": "search", "codicon": "search" }, { "name": "extension.bookmarks", "codicon": "bookmark" }, { "name": "scm", "codicon": "source-control" }, { "name": "extension.gistpad", "codicon": "quote" }, { "name": "debug", "codicon": "debug" }, { "name": "extension.liveshare", "octicon": "broadcast" }, { "name": "extensions", "codicon": "extensions-manage" }, {}, // {"codicon": "kebab-vertical"}, ], "activitusbar.activeColour": "#FFFF00", "activitusbar.inactiveColour": "#AAA", "activitusbar.searchViewInPanel": true, "activitusbar.showSourceControlCounter": true, "[plaintext]": { "editor.quickSuggestions": { "comments": "off", "strings": "off", "other": "off" }, "editor.acceptSuggestionOnEnter": "off", "editor.acceptSuggestionOnCommitCharacter": false, "editor.wordBasedSuggestions": false, "editor.autoIndent": "none", "editor.formatOnSave": false, "editor.tabSize": 2, }, "[dockerfile]": { "editor.defaultFormatter": "ms-azuretools.vscode-docker" }, "[shellscript]": {}, "[markdown]": { "editor.quickSuggestions": { "comments": "on", "strings": "on", "other": "on" }, "editor.defaultFormatter": "DavidAnson.vscode-markdownlint", }, "markdown.preview.breaks": true, "markdown.preview.fontSize": 20, "markdown.preview.lineHeight": 1.5, "[txt]": { "editor.quickSuggestions": { "comments": "on", "strings": "on", "other": "on" } }, "[json]": { "editor.quickSuggestions": { "comments": "on", "strings": "on", "other": "on" }, "editor.autoIndent": "keep", "editor.formatOnSave": true, "editor.defaultFormatter": "vscode.json-language-features", }, "[yaml]": { "editor.quickSuggestions": { "comments": "on", "strings": "on", "other": "on" }, "editor.autoIndent": "keep", "editor.formatOnSave": true, "editor.tabSize": 2, "editor.insertSpaces": true, }, "vscode-yaml-sort.indent": 0, "vscode-yaml-sort.sortOnSave": true, "vscode-yaml-sort.useAsFormatter": true, "[css]": { "editor.insertSpaces": true, "editor.tabSize": 2 }, "css.format.enable": true, "[typescript]": { "editor.quickSuggestions": { "other": false, "comments": true, "strings": true, }, "editor.autoIndent": "brackets", "editor.insertSpaces": true, "editor.formatOnSave": true, "editor.tabSize": 2, "editor.codeActionsOnSave": { "source.fixAll.tslint": true, "source.fixAll.eslint": true, "source.sortImports": false, "source.organizeImports": false, }, }, "typescript.autoClosingTags": false, "typescript.format.enable": true, "typescript.inlayHints.parameterNames.enabled": "all", "typescript.inlayHints.parameterTypes.enabled": true, "typescript.inlayHints.propertyDeclarationTypes.enabled": true, "typescript.inlayHints.functionLikeReturnTypes.enabled": true, "typescript.inlayHints.variableTypes.enabled": true, "typescript.updateImportsOnFileMove.enabled": "always", "[javascript]": { "editor.insertSpaces": true, "editor.formatOnSave": true, }, "javascript.suggestionActions.enabled": true, "javascript.updateImportsOnFileMove.enabled": "always", "[go]": { "editor.quickSuggestions": { "other": false, "comments": true, "strings": true, }, "editor.autoIndent": "brackets", "editor.insertSpaces": false, "editor.tabSize": 4, "editor.formatOnSave": true, "editor.formatOnSaveMode": "file", "editor.codeActionsOnSave": { "source.sortImports": true, "source.organizeImports": true, }, }, "go.languageServerFlags": [ "-rpc.trace" ], "go.useLanguageServer": true, "go.useCodeSnippetsOnFunctionSuggest": true, "go.gotoSymbol.includeImports": true, "go.inferGopath": false, "go.docsTool": "gogetdoc", "go.formatTool": "goimports", "go.lintTool": "golangci-lint", "go.lintFlags": [ "--fast" ], "go.lintOnSave": "file", "go.vetOnSave": "workspace", "go.toolsManagement.autoUpdate": true, "go.toolsEnvVars": {}, "go.delveConfig": { "debugAdapter": "legacy" }, "gopls": { "experimentalWorkspaceModule": true, "analyses": { "fieldalignment": true }, "verboseOutput": true }, "[kotlin]": { "editor.autoIndent": "brackets", "editor.insertSpaces": false, "editor.tabSize": 4, }, "[proto]": { "editor.quickSuggestions": { "comments": "on", "strings": "on", "other": "on" }, "editor.autoIndent": "brackets", "editor.insertSpaces": true, "editor.tabSize": 2, }, "[python]": { "editor.autoIndent": "brackets", "editor.formatOnSave": true, "editor.formatOnPaste": false, "editor.tabSize": 5, "editor.formatOnSaveMode": "file", }, "python.languageServer": "Pylance", "python.pipenvPath": "pipenv", "python.venvPath": "${workspaceFolder}/venv", "python.linting.pylintArgs": [ "--errors-only", "--disable=C0111" ], "python.linting.flake8Enabled": true, "python.linting.flake8Args": [ "--ignore=E501, --max-line-length=120" ], "python.sortImports.args": [ "-rc", "--atomic" ], "python.formatting.provider": "black", "python.formatting.blackArgs": [ "--line-length", "250" ], "python.formatting.yapfArgs": [ "--style", "{based_on_style: google, join_multiple_lines: true, indent_dictionary_value: false, each_dict_entry_on_separate_line: false, spaces_before_comment: 2, split_penalty_excess_character: false, split_penalty_after_unary_operator: true, split_before_logical_operator: false, split_before_dict_set_generator: false, split_before_named_assigns: false, split_complex_comprehension: false, no_spaces_around_selected_binary_operators: '*,/'}" ], "php.validate.executablePath": "/usr/bin/php", "[cpp]": { "editor.formatOnSave": true, "editor.formatOnSaveMode": "modifications", "editor.defaultFormatter": "ms-vscode.cpptools", }, "C_Cpp.clang_format_fallbackStyle": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0, SpacesBeforeTrailingComments: 1}", "[html]": {}, "[xsd]": { "editor.formatOnType": false, "editor.formatOnPaste": false, "editor.formatOnSave": false, }, "[terraform]": { "editor.formatOnType": true, "editor.formatOnPaste": true, "editor.formatOnSave": true, "editor.insertSpaces": true, "editor.tabSize": 2, "editor.quickSuggestions": { "other": true, "comments": false, "strings": true } }, "vs-kubernetes": { "vs-kubernetes.minikube-path.linux": "/home/festum/.vs-kubernetes/tools/minikube/linux-amd64/minikube", "vscode-kubernetes.minikube-path.linux": "/home/festum/.vs-kubernetes/tools/minikube/linux-amd64/minikube", "vs-kubernetes.crd-code-completion": "disabled" }, "diffEditor.renderSideBySide": false, "clock.dateFormat": "yyyy-mm-dd HH:MM:ss", "json.schemaDownload.enable": true, "rest-client.enableTelemetry": false, "material-icon-theme.showUpdateMessage": false, "material-icon-theme.folders.theme": "specific", "material-icon-theme.activeIconPack": "angular_ngrx", "liveshare.presence": true, "liveshare.anonymousGuestApproval": "accept", "liveshare.audio.joinCallBehavior": "accept", "peacock.favoriteColors": [ { "name": "Dracular Blak", "value": "#282a36" }, { "name": "Dracular Comment", "value": "#6272a4" }, { "name": "Dracular Purple", "value": "#bd93f9" }, { "name": "Dracular Pink", "value": "#ff79c6" }, { "name": "Dracular Red", "value": "#ff5555" }, { "name": "Dracular Green", "value": "#50fa7b" }, { "name": "Dracular Yellow", "value": "#f1fa8c" }, ], "sql-formatter.uppercase": true, "redhat.telemetry.enabled": false, "github.copilot.enable": { "*": true, "yaml": false, "plaintext": false, "markdown": false, "go": false, "typescript": false, "python": false, "cpp": false }, "tabnine.experimentalAutoImports": true, "grammarly.files.include": [ "**/*.md", "**/*.txt" ], "cSpell.language": "en-GB,en", "cSpell.logLevel": "Error", "cSpell.allowCompoundWords": true, "cSpell.numSuggestions": 8, "cSpell.minWordLength": 4, "cSpell.maxNumberOfProblems": 100, "cSpell.enableFiletypes": [ "!csharp", "!js", "!python", "!yaml", "kotlin", "makefile", "md", "proto3", "terraform", "txt", ] }
If the issue is resolved by a vscode update, that points to bad interaction of gopls edits with other vs code edits.
Is it reliably reproducible with the older version of vs code?
Yup, still reproducible with older vscode
Thanks for confirming. I think this is probably a VS Code issue, as AFAIK there's nothing in gopls that would lead to this behavior. Please reopen if this is reproducible at the latest VS Code version.
What version of Go are you using (
go version
)?It happens since
1.18.4
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Simply using more than one dependency.
What did you expect to see?
Not freezing vscode
What did you see instead?
gopls
keep importing the same packages