Skip to content
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

x/tools/gopls: missing function literal suggestion #41123

Open
liuwangchen opened this issue Aug 29, 2020 · 3 comments
Open

x/tools/gopls: missing function literal suggestion #41123

liuwangchen opened this issue Aug 29, 2020 · 3 comments
Labels

Comments

@liuwangchen
Copy link

@liuwangchen liuwangchen commented Aug 29, 2020

image

hope ↓

image

@gopherbot gopherbot added this to the Unreleased milestone Aug 29, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 29, 2020

The snippet suggestion you see can be disabled by adding the following setting:

"[go]": {
	"editor.snippetSuggestions": "none",
}

I can't reproduce the lack of a func(...) {} suggestion though - can you please provide a complete repro case? What does the rest of the file look like?

@stamblerre stamblerre changed the title x/tools/gopls:bad suggestion x/tools/gopls: missing function literal suggestion Aug 29, 2020
@stamblerre stamblerre removed this from the Unreleased milestone Aug 29, 2020
@muirdm
Copy link

@muirdm muirdm commented Aug 30, 2020

I was able to reproduce the missing completion with:

package main

func haha(fn func(value int)) {
}

func _() {
	haha(func<>)
	if true {
	}
}

We think "<>" is within a function literal, so we don't continue up to infer an expected type of func(int). The easiest fix would probably be to not count us as "in" the *ast.FuncLit in breaksExpectedTypeInference.

@liuwangchen
Copy link
Author

@liuwangchen liuwangchen commented Aug 31, 2020

The snippet suggestion you see can be disabled by adding the following setting:

"[go]": {
	"editor.snippetSuggestions": "none",
}

I can't reproduce the lack of a func(...) {} suggestion though - can you please provide a complete repro case? What does the rest of the file look like?

image

I used "editor.snippetSuggestions": "none" but don't work.....

here is my setting is has wrong?

{
"debug.console.fontFamily": "Menlo",
"workbench.iconTheme": "vs-nomo-dark",
"workbench.colorCustomizations": {
"editor.background": "#2b2b2b",
"debugConsole.infoForeground": "#bdb1b1",
"statusBar.background": "#2b2b2b",
},
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "support.function",
"settings": {
"foreground": "#d2d2d2"
}
}
],
},
"editor.lineHeight": 22,
"debug.console.fontSize": 13,
"extensions.ignoreRecommendations": true,
"markdown.preview.linkify": false,
"markdown.preview.doubleClickToSwitchToEditor": false,
"explorer.confirmDelete": false,
"workbench.settings.openDefaultSettings": true,
"rest-client.disableAddingHrefLinkForLargeResponse": false,
"rest-client.disableHighlightResonseBodyForLargeResponse": false,
"rest-client.previewResponsePanelTakeFocus": false,
"rest-client.previewResponseInUntitledDocument": true,
"rest-client.decodeEscapedUnicodeCharacters": true,
"rest-client.environmentVariables": {
"shared": {
"local": "localhost",
"localj": "localhost:8460",
"test": "10.142.117.99",
"testj": "10.142.117.99/j",
"testp": "passport.test.huajiao.com",
"onlinep": "10.143.166.108",
"yufabuip": "10.142.116.104",
"platform": "ios",
"version": "7.1.1",
}
},
"explorer.confirmDragAndDrop": false,
"files.autoSave": "afterDelay",
"yaml.validate": false,
"[dockerfile]": {
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
},
"workbench.editor.enablePreview": false,
"window.zoomLevel": 0,
"workbench.sideBar.location": "left",
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
},
"vim.insertModeKeyBindings": [],
"vim.leader": "",
"vim.easymotion": true,
"vim.easymotionMarkerWidthPerChar": 10,
"vim.easymotionKeys": "hklyuiopnmqwetzxcvbasdgjf",
"vim.easymotionMarkerForegroundColorTwoChar": "#f6f9a5",
"vim.easymotionDimBackground": false,
"vim.useCtrlKeys": true,
"vim.surround": true,
"vim.searchHighlightColor": "#32593d",
"go.autocompleteUnimportedPackages": false,
"[go]": {
"editor.insertSpaces": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.organizeImports": true
},
"editor.snippetSuggestions": "none",
},
"gopls": {
"usePlaceholders": true,
"completeUnimported": true,
},
"go.lintTool": "golangci-lint",
"go.lintOnSave": "off",
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
"diagnostics": false,
"documentLink": false
},
"go.formatTool": "goimports",
"go.addTags": {
"tags": "json,form",
"options": "json=omitempty",
"promptForTags": false,
"transform": "snakecase"
},
"editor.dragAndDrop": false,
"explorer.autoReveal": false,
"editor.quickSuggestions": true,
"editor.suggest.insertMode": "replace",
"editor.wordBasedSuggestions": false,
"editor.suggestSelection": "recentlyUsedByPrefix",
"editor.snippetSuggestions": "inline",
"editor.parameterHints.enabled": false,
"editor.multiCursorModifier": "ctrlCmd",
"timeline.excludeSources": [],
"editor.matchBrackets": "near",
"editor.autoClosingBrackets": "beforeWhitespace",
"editor.autoClosingQuotes": "never",
"editor.autoSurround": "never",
"search.searchOnType": true,
"replacerules.rules": {
"url format": {
"find": "&",
"replace": "\n&"
},
},
"explorer.compactFolders": false,
"workbench.editor.showTabs": false,
"hediet.vscode-drawio.local-storage": "eyIuZHJhd2lvLWNvbmZpZyI6IntcImxhbmd1YWdlXCI6XCJcIixcImN1c3RvbUZvbnRzXCI6W10sXCJsaWJyYXJpZXNcIjpcImdlbmVyYWw7dW1sO2VyO2JwbW47Zmxvd2NoYXJ0O2Jhc2ljO2Fycm93czJcIixcImN1c3RvbUxpYnJhcmllc1wiOltcIkwuc2NyYXRjaHBhZFwiXSxcInBsdWdpbnNcIjpbXSxcInJlY2VudENvbG9yc1wiOltdLFwiZm9ybWF0V2lkdGhcIjpcIjI0MFwiLFwiY3JlYXRlVGFyZ2V0XCI6ZmFsc2UsXCJwYWdlRm9ybWF0XCI6e1wieFwiOjAsXCJ5XCI6MCxcIndpZHRoXCI6MjMzOSxcImhlaWdodFwiOjMzMDB9LFwic2VhcmNoXCI6dHJ1ZSxcInNob3dTdGFydFNjcmVlblwiOnRydWUsXCJncmlkQ29sb3JcIjpcIiNkMGQwZDBcIixcImRhcmtHcmlkQ29sb3JcIjpcIiM2ZTZlNmVcIixcImF1dG9zYXZlXCI6dHJ1ZSxcInJlc2l6ZUltYWdlc1wiOm51bGwsXCJvcGVuQ291bnRlclwiOjAsXCJ2ZXJzaW9uXCI6MTgsXCJ1bml0XCI6MSxcImlzUnVsZXJPblwiOmZhbHNlLFwidWlcIjpcIlwifSJ9",
"rest-client.fontFamily": "",
"editor.fontSize": 13.2,
"git-graph.graphColours": [
"#ff6d67",
"#59f68d",
"#f3f89d",
"#c9a8fa",
"#ff92d0",
"#99ecfd",
"#00d9cc",
"#e138e8",
"#85d900",
"#dc5b23",
"#6f24d6",
"#ffcc00"
],
"editor.suggest.showColors": false,
"editor.suggestOnTriggerCharacters": true,
"editor.quickSuggestionsDelay": 0,
"editor.suggest.statusBar.visible": false,
"open-in-browser.default": "chrome",
"code-runner.clearPreviousOutput": true,
"code-runner.ignoreSelection": true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.