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
[GraphQL] Add support for Block Strings #261
Conversation
d2ae12d
to
eb303bd
Compare
Hi, I've rebased and added a test for where a block string is used within code. Is there anything that's still not working? |
Hi @stkb! Thanks for pushing that commit. This is really close. I noticed that for indented block strings, Rewrap loses the indentation... eg. Before:
After
I'll see if I can fix up the regex later today as that's where I feel the issue might lie. :) |
Not sure why it's not working for you. It's working fine for me! (also in the CI) If you like you can test it by installing the extension from this file (rename the .zip file to .vsix and install from within vscode) If you're happy I'll go ahead and merge it. |
Thanks for sending the test build. I installed it and here's an example of
what it's doing now. It's interesting that the test cases you added on the
branch are passing. I can't see what's different though.
https://user-images.githubusercontent.com/77138/112045066-a8535e80-8b07-11eb-80ac-f47d2d0d85e0.mov
|
Hmm yeah I see. I'm not getting the same though. Have you tried with all other extensions disabled? |
Hm... I disabled every extension and uninstalled Rewrap. Even then, if I run the code, it still strips the leading indent like in the video. Does Rewrap do any logging that'd help figure out what's going on? Sorry, I'm very unfamiliar with F# and it's taking me a bit to trace how it works. :) |
Yeah I wouldn't go spending time trying to figure out the F# codebase just yet because it's not easy. It doesn't really have any logging, but I could add some or direct you where to look while debugging. In the mean time could you paste your settings.json here? (Remove anything personal) Also it may sound silly but could you attach a copy of an example file that's not working for you? (you may have to zip it up) Do you have Visual Studio installed or just VS Code? I will get back to you tomorrow (European time) |
Here's settings.json Expand
{
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "vscode.json-language-features"
},
"[markdown]": {
"editor.formatOnSave": false
},
"[python]": {
"editor.formatOnSave": false
},
"[shellscript]": {
"editor.formatOnSave": false,
},
"[xml]": {
"editor.formatOnSave": false
},
"[yaml]": {
"editor.formatOnSave": false
},
"debug.console.fontFamily": "Hasklig",
"debug.console.fontSize": 13,
"diffEditor.renderSideBySide": false,
"editor.autoClosingBrackets": "never",
"editor.dragAndDrop": false,
"editor.fontLigatures": true,
"editor.fontFamily": "Hasklig",
"editor.fontSize": 13,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.minimap.enabled": false,
"editor.renderWhitespace": "none",
"editor.rulers": [
79
],
"editor.scrollBeyondLastLine": false,
"editor.suggest.localityBonus": true,
"editor.tabCompletion": "on",
"explorer.openEditors.visible": 0,
"extensions.ignoreRecommendations": false,
"files.associations": {"*.gotxt": "go"},
"files.autoGuessEncoding": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"flow.showUncovered": true,
"git.ignoreMissingGitWarning": true,
"gitlens.codeLens.enabled": false,
"go.autocompleteUnimportedPackages": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast",
"--fix"
],
"javascript.autoClosingTags": false,
"javascript.suggest.autoImports": false,
"javascript.updateImportsOnFileMove.enabled": "never",
"npm.packageManager": "yarn",
"prettier.requireConfig": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/usr/local/bin/black",
"python.formatting.blackArgs": [
"--skip-string-normalization",
"--line-length", "79"
],
"python.languageServer": "Pylance",
"rewrap.reformat": true,
"rewrap.wrappingColumn": 79,
"rewrap.wholeComment": false,
"rewrap.autoWrap.enabled": true,
"rewrap.autoWrap.notification": "icon",
"rust-client.trace.server": "messages",
"search.searchOnType": false,
"search.searchOnTypeDebouncePeriod": 5000,
"search.showLineNumbers": true,
"shellformat.flag": "-i 2",
"terminal.integrated.fontSize": 12,
"terminal.integrated.shell.osx": "/usr/local/bin/fish",
"typescript.suggest.autoImports": false,
"typescript.updateImportsOnFileMove.enabled": "never",
"workbench.editor.closeOnFileDelete": true,
"workbench.editor.enablePreview": false,
"workbench.editor.highlightModifiedTabs": true,
"workbench.editor.labelFormat": "medium",
"workbench.editor.revealIfOpen": true,
"workbench.editor.showTabs": true,
"workbench.tree.indent": 16,
"workbench.settings.editor": "json",
"window.restoreWindows": "none",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
} Here's a sample that rewraps incorrectly for me... type LoginUserMutation {
id: String
firstName: String
lastName: String
username: String
}
type Mutation {
"""
This is a test. If you type and cause wrapping, it'll remove the indent.
"""
loginUser(username: String!, password: String!) LoginUserMutation
} |
I feel like a fool. It's the I should have thought of it sooner, but I forget about that setting and am actually planning on removing it. Anyway yeah that's the problem |
Hey, glad we found it. I removed that setting and it works great! I've resolved the merge conflicts and it's good to land as far as I'm concerned! Thanks for your help! |
Great, thanks! |
This PR extends the GraphQL file support to include Block Strings.
This is not complete. I have preliminary support working, but indentation is broken. Will see if I can get that working.
Closes: #260