Close #1061. Help Debug Editor command creates Gist (no Clipboard)
This commit is contained in:
parent
9ae1b4c8d0
commit
0212f49c83
|
@ -1,8 +1,8 @@
|
|||
### Description
|
||||
# Description
|
||||
|
||||
The results of beautification are not what I expect.
|
||||
|
||||
### Expected Results
|
||||
# Expected Results
|
||||
|
||||
The beautified code should have looked like:
|
||||
|
||||
|
@ -10,33 +10,20 @@ The beautified code should have looked like:
|
|||
<INSERT CODE HERE>
|
||||
```
|
||||
|
||||
### Steps to Reproduce
|
||||
# Steps to Reproduce
|
||||
|
||||
1. Add code to Atom editor
|
||||
2. Run command `Atom Beautify: Beautify Editor`
|
||||
3. This beautified code does not look right!
|
||||
|
||||
### Debug
|
||||
# Debug
|
||||
|
||||
Here is a link to the `debug.md` Gist: https://gist.github.com/...
|
||||
|
||||
#### How to create `debug.md` Gist
|
||||
|
||||
Note that this will include a copy of your code.
|
||||
If your code is private, please create a different sample of code that reproduces the problem.
|
||||
|
||||
1. In the Atom [command-palette](https://atom.io/packages/command-palette),
|
||||
search for and run the command `Atom Beautify: Help Debug Editor`.
|
||||
The debugging results will be copied to your clipboard.
|
||||
2. Create a new Gist at https://gist.github.com/
|
||||
3. Create a file in your new Gist called `debug.md`.
|
||||
4. Paste your debugging results from Atom beautify into `debug.md` file in your Gist.
|
||||
5. Add a link to your Gist in your new Issue.
|
||||
Here is a link to the `debug.md` Gist: <INSERT GIST HERE>
|
||||
|
||||
# Checklist
|
||||
|
||||
- [ ] I have tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
|
||||
- [ ] I have reloaded (or restarted) Atom to ensure it is not a caching issue
|
||||
- [ ] Searched for existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
|
||||
- [ ] Searched for existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
|
||||
so I know this is not a duplicate issue
|
||||
- [ ] Generated debugging information and added link for `debug.md` Gist to this issue
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
# Troubleshooting
|
||||
|
||||
Coming soon.
|
||||
## How to create `debug.md` Gist
|
||||
|
||||
Note that this will include a copy of your code.
|
||||
If your code is private, please create a different sample of code that reproduces the problem.
|
||||
|
||||
1. In the Atom [command-palette](https://atom.io/packages/command-palette),
|
||||
search for and run the command `Atom Beautify: Help Debug Editor`.
|
||||
The debugging results will be copied to your clipboard.
|
||||
2. Create a new Gist at https://gist.github.com/
|
||||
3. Create a file in your new Gist called `debug.md`.
|
||||
4. Paste your debugging results from Atom beautify into `debug.md` file in your Gist.
|
||||
5. Add a link to your Gist in your new Issue.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function hell() {
|
||||
function hello() {
|
||||
console.log('world');
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
function hell() {
|
||||
function hello() {
|
||||
console.log('world');
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
"expand-home-dir": "0.0.3",
|
||||
"extend": "^3.0.0",
|
||||
"gherkin": "2.12.2",
|
||||
"github": "^2.2.0",
|
||||
"handlebars": "^4.0.2",
|
||||
"js-beautify": "^1.6.3",
|
||||
"jscs": "^3.0.7",
|
||||
|
@ -122,6 +123,7 @@
|
|||
"marko-prettyprint": "^1.1.8",
|
||||
"node-dir": "^0.1.15",
|
||||
"node-uuid": "^1.4.3",
|
||||
"open": "0.0.5",
|
||||
"prettydiff": "^1.16.27",
|
||||
"pug-beautify": "^0.1.1",
|
||||
"remark": "^4.2.2",
|
||||
|
@ -268,4 +270,4 @@
|
|||
"lint": "coffeelint src/ spec/",
|
||||
"code-docs": "codo && open docs/code/index.html"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,6 +282,11 @@ beautifyDirectory = ({target}) ->
|
|||
|
||||
debug = () ->
|
||||
|
||||
open = require("open")
|
||||
fs ?= require "fs"
|
||||
GitHubApi = require("github")
|
||||
github = new GitHubApi()
|
||||
|
||||
plugin.checkUnsupportedOptions()
|
||||
|
||||
# Get current editor
|
||||
|
@ -297,8 +302,11 @@ debug = () ->
|
|||
if not editor?
|
||||
return confirm("Active Editor not found.\n" +
|
||||
"Please select a Text Editor first to beautify.")
|
||||
return unless confirm('Are you ready to debug Atom Beautify?\n\n' +
|
||||
'Warning: This will change your current clipboard contents.')
|
||||
return unless confirm('Are you ready to debug Atom Beautify?\n\n'+
|
||||
'Warning: This will create an anonymous Gist on GitHub (publically accessible and cannot be easily deleted) '+
|
||||
'containing the contents of your active Text Editor.\n'+
|
||||
'Be sure to delete any private text from your active Text Editor before continuing '+
|
||||
'to ensure you are not sharing undesirable private information.')
|
||||
debugInfo = ""
|
||||
headers = []
|
||||
tocEl = "<TABLEOFCONTENTS/>"
|
||||
|
@ -465,14 +473,39 @@ debug = () ->
|
|||
debugInfo = debugInfo.replace(tocEl, toc)
|
||||
|
||||
# Save to clipboard
|
||||
atom.clipboard.write(debugInfo)
|
||||
confirm('Atom Beautify debugging information is now in your clipboard.\n' +
|
||||
'You can now paste this into an Issue you are reporting here\n' +
|
||||
'https://github.com/Glavin001/atom-beautify/issues/\n\n' +
|
||||
'Please follow the contribution guidelines found at\n' +
|
||||
'https://github.com/Glavin001/atom-beautify/blob/master/CONTRIBUTING.md\n\n' +
|
||||
'Warning: Be sure to look over the debug info before you send it, '+
|
||||
'to ensure you are not sharing undesirable private information.'
|
||||
# atom.clipboard.write(debugInfo)
|
||||
github.gists.create({
|
||||
files: {
|
||||
"debug.md": {
|
||||
"content": debugInfo
|
||||
}
|
||||
},
|
||||
public: true,
|
||||
description: "Atom-Beautify debugging information"
|
||||
}, (err, res) ->
|
||||
# console.log(err, res)
|
||||
if err
|
||||
confirm("An error occurred when creating the Gist: "+err)
|
||||
else
|
||||
gistUrl = res.html_url
|
||||
# Create Gist
|
||||
open(gistUrl)
|
||||
confirm("Your Atom Beautify debugging information can be found in the public Gist:\n#{res.html_url}\n\n" +
|
||||
# 'You can now paste this into an Issue you are reporting here\n' +
|
||||
# 'https://github.com/Glavin001/atom-beautify/issues/\n\n' +
|
||||
# 'Please follow the contribution guidelines found at\n' +
|
||||
# 'https://github.com/Glavin001/atom-beautify/blob/master/CONTRIBUTING.md\n\n' +
|
||||
'Warning: Be sure to look over the debug info before you send it '+
|
||||
'to ensure you are not sharing undesirable private information.\n\n'+
|
||||
'If you want to delete this anonymous Gist read\n'+
|
||||
'https://help.github.com/articles/deleting-an-anonymous-gist/'
|
||||
)
|
||||
# Create GitHub Issue
|
||||
return unless confirm("Would you like to create a new Issue on GitHub now?")
|
||||
issueTemplate = fs.readFileSync(path.resolve(__dirname, "../ISSUE_TEMPLATE.md")).toString()
|
||||
body = issueTemplate.replace("<INSERT GIST HERE>", gistUrl)#.replace("<INSERT CODE HERE>", text)
|
||||
open("https://github.com/Glavin001/atom-beautify/issues/new?body=#{encodeURIComponent(body)}")
|
||||
|
||||
)
|
||||
try
|
||||
beautifier.beautify(text, allOptions, grammarName, filePath)
|
||||
|
|
Loading…
Reference in New Issue