Jump to content

adrian

PW-Moderators
  • Posts

    11,263
  • Joined

  • Last visited

  • Days Won

    374

Everything posted by adrian

  1. I haven't packaged the other themes with Tracy yet, but I can do so if you guys are interested. I initially went with just one theme (my favorite) because I wasn't sure how much use the Console and File Editor panels would get, but given their popularity I think it probably makes sense to include all the themes so you guys can choose what you prefer. I guess the next question is to figure out whether you guys want to be able to adjust all ACE editor settings via a textarea with key:value pairs or whether I should provide the key settings I think you might want to adjust as dedicated fields in the module settings like I have with the tab size, type and show invisibles settings. What does everyone think?
  2. If you hook after Page::render you can assign $event->return to a variable and use that.
  3. Agreed - I don't want either the Console panel or FileEditor panel to slow down at all - I'll make sure that any autocomplete/snippet stuff I add doesn't cause any slowdown. Glad that in general you enjoy using these tools. The best way to change the editor color is to use the built in themes. I actually haven't included any other themes with the Tracy package, but I could easily add these and create a new module config setting so you can choose the theme - there are a lot of options - check out the kitchen sink demo (https://ace.c9.io/build/kitchen-sink.html) and try out the Theme dropdown.
  4. I am curious what you discover testing this. I haven't ever played with the noFields option. If is doesn't work out fast, you might be better off with direct DB manipulation of parent_id field, but if you do take that approach be aware that you'll also need to update the pages_parents table as well. Sorry I missed your more recent posts about the discovered bug. Thanks for digging into that!
  5. "parent" is not the name of a field. If you are trying to set the parent of the page you'll need to do this: $page->parent = 'x'; $page->save();
  6. Also just got this working, all generated automatically from the currently PW install, so it's always up-to-date. Do you guys think you'd make use of this?
  7. @cosmicsafari - please check out my fork of the AssistedURL module: https://github.com/adrianbj/processwire-fieldtype-assisted-url It stores links as IDs so links are updated if names are changed.
  8. Or perhaps this is even cleaner for the plain PW variables when they are not actually snippets:
  9. Yeah, already done on my dev copy - all PW variables are automatically added to the autocomplete. Agreed - I am working on this - I don't necessarily want to disable php autocompletions completely, but trying to tweak the triggering so it's not invasive when you don't want it.
  10. What do you guys think of me adding things like this:
  11. Ok, I have implemented the ability to link to your own custom snippets file: If you're using a Github Gist, make sure you use the https://rawgit.com/ service because the raw file from Github is served without the correct mime type and won't work. The format of the custom snippet file is like this. Note the getCustomCodeSnippets() compared with the core snippets file which uses getCodeSnippets() var getCustomCodeSnippets = function() { return [ { name: "pwfind", content: "d(\\$pages->find(\"template=\${1:basic-page}\")->each(\"\${2:title}\"));", tabTrigger: "pwfind" }, { name: "pwforeach", content: "foreach(\\$pages->find(\"template=\${1:basic-page}\") as \\$p) {\n\td(\\$p);\n}", tabTrigger: "pwforeach" } ] }; At the moment the custom snippets file is PHP only. I don't think we will ever need other languages for this. I have also added in the ACE core snippet files for other web related languages so if you use the File Editor panel for JS, CSS, etc, there will now be a bunch of useful snippets for those languages as well. If you want to peruse the available ACE core snippets, the best way is probably here: https://github.com/ajaxorg/ace/blob/master/lib/ace/snippets/php.snippets You can also check out the snippets for other languages in the parent folder of that file.
  12. I'd need to look into this a little more to figure out how to get the label if you have defined a manual value, but if you don't define a value, then it automatically returns the label: Would this work for you, or do you need to specify a value for each option? Got to sleep here, but this shows that you could parse this yourself by grabbing the field's colnoptions setting. Not exactly elegant, but it'll work..
  13. I was actually thinking along those lines as well, but I do want to encourage PRs to main file that comes with Tracy as well. But yeah if you want to add support for pointing to a Github gist URL, or any other URL I suppose, I think that would be a nice addition.
  14. OK, just released a major new version: 4.12.0 1) New Title/View link in Dump tabs, so ID is edit link and title/name is view link 2) New PagePermissions section added to PW Info panel: 3) New PHP and custom PW autocomplete snippets added to the Console and File Editor panels. Here's one example, but there are others in the posts prior to this one showing general PHP snippets. Currently there are two custom PW snippets: pwforeach and pwfind - I'd love to hear what you guys want to see here. If you have new snippet ideas, please take a look at: https://github.com/adrianbj/TracyDebugger/blob/master/scripts/code-snippets.js and feel free to send PRs with new additions. 4) Ability to dynamically resize the font in the Console and File Editor panels with: Increase: CTRL + +/= Decrease: CTRL + -/_ Reset: CTRL + 0 5) Changes to the way the Console panel divs are structured and resized - please let me know if you see any issues with the results panel protruding beyond the bottom of the panel or any other issues. It's still not perfect, but it's breaking my brain ? 6) Some minor Tracy core updates and also general cleanup of many of the custom panels. Please let me know if you have any problems with this new version, or ideas for improvements!
  15. Hey @bernhard - sorry I forgot to respond to this before. This is certainly a possibility if there is demand. The advantage of course is that panel authors can maintain the codebase for their panel completely without relying on me to handle PRs etc. The downside is that new Tracy users needs to hunt around to find third-party panels so if we take this approach we'll want to make sure to list them all on a dedicated page on the docs site. Let me know if anyone out there is interested in this.
  16. ACE also comes with a bunch of predefined PHP snippets. This will all be available in the next release of Tracy.
  17. Sorry, not sure I understand how this makes things cross editor compatible. Honestly I think that all these should probably be in the core. After-all we have the actual snippets panel for you to define and use your own custom ones that others may not find useful.
  18. OT again! just in case anyone is interested, I have started working on this: https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=174121 Would appreciate any and all input of those of you who love autocompletion snippets ?
  19. Hey @bernhard and anyone else who might be interested. Following up on my thoughts over here: Here's my first test: This comes from a new file which currently contains: var getCodeSnippets = function() { return [ { content: 'd(\\$pages->find("template=\${1:basic-page}")->each("\${2:title}"));', name: 'find-pages', tabTrigger: 'pwfind' } ] }; I feel like there needs to be some thought put into how these should work and what the tabTrigger text should be. As you can see this one is about directly d() 'ing, but I am not sure whether it would be more versatile without that wrapping d(). Perhaps we could have both versions? Maybe we also want something that simply returns: foreach($pages->find("template=basic-page") as $p) { d($p); } I am really not sure what approach to take here. Also, do you guys want to contribute snippets to the Tracy core, or would you prefer being able to define your own in a file or in the config settings? Any thoughts? Thanks!
  20. I would certainly welcome this functionality in Tracy, but I am not super excited on building this at the moment, but if you're feeling motivated, I am sure with the code from LK's module and the quick guide I just put together you should have a decent starting point. Of course it will need to be updated to support the new access functionality that Ryan added fairly recently.
  21. Haha - no, errant keyboard shortcut saved the post ? It's been "completed" now, although it really needs some work and should be moved to the docs site as I mentioned.
  22. I'd love some help ? If people have ideas for other panels that would be brilliant. It's really very simple to get a panel working and what you do with it is up to you. Maybe I'll add this to the docs site (https://adrianbj.github.io/TracyDebugger/#/) at some point, or maybe someone could do that for me, but here are the really quick basics. Create a new file under the panels subdirectory named to match the name of your new panel, eg: MyNewPanel.php In that file have a class MyNewPanel that extends BasePanel, eg: class MyNewPanel extends BasePanel { Add getTab() method optional isAdditionalBar() method to check if the current call to the panel is from an AJAX or Redirect debug bar. Some panels are not relevant for these bars, so you can check that and return if you wish. timer() method to check how long it takes to generate this panel. return a span with title tag (for mouseover of the panel icon in the debug bar) with the SVG for the icon and a label. It's up to you to assign the SVG to that $this->icon variable. public function getTab() { if(\TracyDebugger::isAdditionalBar()) { return; } \Tracy\Debugger::timer('myNew'); return ' <span title="My Panel"> ' . $this->icon . (\TracyDebugger::getDataValue('showPanelLabels') ? ' My Panel' : '') . ' </span>'; } Add getPanel() method if this panel does work with additional bars, then check for this and add the name of the bar in parentheses in the <h1> title output should all be contained in a tracy-inner div use generatePanelFooter to create the ms/kb values in the footer of the panel. The last parameter (optional) is for a hash link to the docs website return - parent::loadResources() actually currently returns nothing but it's in the BasePanel class and may be used again at some point, so should be included in the return. The minify() method is not mandatory but I use it in some panels with a lot of embedded JS / HTML. Note that it's very rudimentary and currently is broken by inline comments in $out so be careful. public function getPanel() { $isAdditionalBar = \TracyDebugger::isAdditionalBar(); $out = ' <h1> <a title="My New"> ' . $this->icon . ' My New </a>' . ($isAdditionalBar ? ' ('.$isAdditionalBar.')' : '') . ' </h1> $out = '<div class="tracy-inner">'; $out .= 'whatever you want output in the panel'; $out .= \TracyDebugger::generatePanelFooter('myNew', \Tracy\Debugger::timer('myNew'), strlen($out), 'myNew'); $out .= '</div>'; return parent::loadResources() . \TracyDebugger::minify($out); } You have access to these color constants from the main \TracyDebugger class: const COLOR_LIGHTGREY = '#999999'; const COLOR_GREEN = '#009900'; const COLOR_NORMAL = '#354B60'; const COLOR_WARN = '#ff8309'; const COLOR_ALERT = '#cd1818'; You can access module config settings with: \TracyDebugger::getDataValue('settingName'); Once the panel is built, you can add it to Tracy here: https://github.com/adrianbj/TracyDebugger/blob/dd617b8ca8f450b8891ecacaef2b3949698fc126/TracyDebugger.module#L139-L169 That's a very rough first draft of what needs to happen. I think the best place to start is probably the MethodsInfoPanel.php file because it's so simple. This process has reminded me of just how messy some things are ?
  23. We have PHP function completion, but not completion for PW objects / functions etc. I could create a file to handle this but would need to script something up so that the completion file is built automatically from the PW codebase. Sounds good. I have actually been thinking about including a few default "code snippets" in the Snippets panel. Maybe this would actually be better as a "completion snippet". Sorry, trying to distinguish the two different things ? Obviously getting OT, so let's continue this in the Tracy thread, but I'd certainly like your input on this if you're interested. I don't have completion snippets turned on in the Console panel at the moment, but I'll take a look at this later and figure out the format required for snippets and then maybe you could put together a few useful ones.
  24. @bernhard - you've got me thinking that many of these could be great additions to the Tracy Console and File Editor panels using ACE Editor's snippets functionality. Just to clarify - I am talking about code completion features of ACE and not the snippets list panel that I have added to the Console panel. Two totally different things ?
  25. Sure - don't think I'll bother with the title attribute here though - it should be obvious enough. I also changed the order so the more important/relevant ones are on the left, although I am not really sure where "list" belongs ?
×
×
  • Create New...