Is there a standard way to document Svelte components? - visual-studio-code

I come from the world of JavaDocs and love the DX of working on a thoroughly-annotated application after a certain level of complexity.
Being able to hover over and peek all the props (and implied types) of a component with some brief documentation would save me so much time instead of having to open up and read through the whole component. Better yet, running a command to generate a documentation site just like you can with JavaDocs would be dope!
Are there any standards or tools built around creating SvelteDocs? I looked through the VS Code marketplace and didn't see any documentation tooling related to Svelte.

I stumbled upon this question in search of more in-depth documentation for the hover/peek documentation method I've been using. It seems that it is not very well documented (ironically) but it is a part of Svelte language-tools and I've been using it for some time with Svelte for VS Code so I'm sure there was more documentation at some point. The way it's used is as follows in your component. I remember reading somewhere that it needs to be the first thing in your component, but I can't find that source anymore.
<!--
#component
some markdown here
-->
For some reasons the only documentation I can find of it is here. But it provides very nice markdown support so you can craft some very informative hover/peek documentation for your components.
EDIT:
Still can't locate official documentation for the #component commenting feature but realized it is indeed described in the FAQ: https://svelte.dev/faq#how-do-i-document-my-components Does this information belong in the actual docs? Maybe.

After more digging, I found just a couple projects for documenting Svelte.
SvelteDoc Parser -- takes a VueDoc approach, based on JSDoc standards, generates JSON documentation for Svelte components
Svelte-Docs -- documentation in Markdown mixed with Svelte's features, can embed components in the generated doc pages
Both look interesting while taking completely separate approaches to solving the issue of application documentation. Perhaps there's still room to build a CLI-based site generator for the SvelteDoc Parser which could be turned into a VS Code plugin!

It is difficult to find a good one. I recommend
https://github.com/carbon-design-system/sveld
It looks very promising. It offers export in Typescript definitions, JSON and Markdown. In my opinion there is only one critical bug left (Markdown generation) so hopefully it can be used very soon.

Related

Is it possible to set a debug point in FreeMarker template file?

I have a lot of coding in FreeMarker template files for view layer in my app.
I was wondering if I can set a debug point with Eclipse. Is there any good plugin that I can use to debug FreeMarker template files?
As far as I know, you cannot. A template file is a plain text file that the template engine reads into memory and then uses to produce a document that it writes to the response. It's not actually executable code. You can put a breakpoint in the template engine code and follow along what it replaces and how.
FreeMarker has a debugging API, although it has stuck in experimental state eons ago, mostly because nobody has taken the effort to write a front-end for it (like an Eclipse plugin). Except, I know they have planned to support it under some of the next LifeRay IDE versions. As far as I know they managed with break points, but there's no support for stepping in the FreeMarker API for example.
This is an old question and answering it right now doesn't make sense, but maybe it helps to all those people who often visit this page to find whether there is a way to debug freemarker or not.
As in the earlier answer it was stated that there is an Official API for the debugging, so just to add a little more into it for beginners.
Please refer to this official API and check freemarker.debug package [as official description says - Debugging API; experimental status, might change! This is to support debugging in IDE-s.], it is surely to help.
FreeMarker 2.3.29

Converting from doxygen comments in visual studio c#, to javadoc comments in eclipse

I am porting doxygen documentation from visual studio c# project to java eclipse project.
Can you please suggest tutorials or some guides for mapping the one style of comments
to the other?
For example, how do I translate this doxygen comment to javadoc comment?
/// the custom solution data type, derived from Solution
Thanks
Speaking from the perspective of one who has tried to map from doxygen (in C) to javadoc I think you will find this direction remarkably difficult, especially if you have much narrative in your original commentary. I find javadoc dreadfully lacking in most of the capabilities of doxygen, so really only the absolute minimum commentary can be usefully transferred - things like #param, #return etc. I've never found any good tutorials, or even any bad ones. I suspect this isn't something people do by choice.
Consider whether you could continue to use doxygen. Doxygen interprets all the javadoc commands (at least all the ones I've come across), and you can benignly add doxygen '\'-style commands into the java commentary without upsetting any existing javadoc processing.
Edit: Just to clarify that point slightly. Javadoc won't have warnings or errors as a result of using \command entries, but the \command text will emerge in the javadoc output as text.
The downside, of course, is that javadoc is needed if you want pop-ups in your IDE (e.g. Eclipse) so if that's a requirement then using doxygen instead won't be much use. However, if you just need to create good quality HTML documentation / manuals with diagrams and narrative then it might be an option.

what happened to gtk_source_iter_forward_search in gtksourceview-3.0

I've looked at the GtkSourceView 3 Reference Manual, and I've googled for a while, but I cannot find any mention of why gtk_source_iter_forward_search was dropped from gtksourceview or what should be used instead.
I've also looked at the features link at the gtksourceview website where it lists as a feature: Caseless UTF-8 compliant search.
I've looked at the gedit source ver 3.2.6 (since I know they use gtksourceview), but they seem to be using gedit_document_search_forward, which I'm guessing comes from some other library. So my question is, what happened to the search capabilities in gtksourceview? Is there another library that provides similar functionality to gtk_source_iter_forward_search, or is it now done another way within gtksourceview?
I originally wrote my editor in gtksourceview-2.0, now I am rewriting it using gtksourceview-3.0, and I have an established search forward function based on the gtk_source_iter_forward_search function.
Thanks.
Always browse the source if you want to know these things. I found in this commit that GtkSourceIter was removed because the functionality was moved to GtkTextIter.

Objective-C Documentation Generators: HeaderDoc vs. Doxygen vs. AppleDoc

I need to implement a documentation generation solution for my workplace and have narrowed it down to the three mentioned in the title. I have been able to find very little information in the way of formalized comparisons between these solutions, and I'm hoping that those of you with experience in one or more of the above can weigh in:
Here is what I have been able to glean from my initial pass:
HeaderDoc Pros: Consistent with apple's existing docs, compatibility with making apple docsets
HeaderDoc Cons: Difficult to modify behavior, project is not actively worked on, many have switched away from it (meaning there must be something deficient, though I can't quantify it).
Doxygen Pros:
Active support community b/c of wide use base, very customizable, most output types (like latex etc)
Doxygen Cons:
Takes work to make it look/behave consistent with apples docs, compatibility with apple docsets is not as simple
AppleDoc Pros:
Looks consistent with apple's existing docs, compatibility with making apple docsets,
AppleDoc Cons:
Issue with documentation of typedefs, enums, and functions, actively being developed
Does this sound accurate? Our desired solution will have:
Consistent look and feel with apples objective-c class reference
Ability for option-click to pull up documentation reference from within Xcode, and then link to the doc (just like apple's classes)
Smart handling of categories, extensions, and the like (even custom categories of apple's classes)
Ability to create our own reference pages (like this page: Loading… that can include images, and be linkable from generated class references seamlessly, like how apple's UIViewController class reference links to the linked page.
Easy to run command line commands that can be integrated into build scripts
Graceful handling of very large codebase
Based on all of the information above, are any of the above solutions clearly better than the others? Any suggestions or information to add would be extremely appreciated.
As the creator and lead developer of doxygen, let me also provide my perspective
(obviously biased as well ;-)
If you are looking for a 100% faithful replica of Apple's own documentation style, then AppleDoc is a better choice in that respect. With doxygen you'll have a hard time to get that exact same look, so I would not recommend to try.
With respect to Xcode docsets; Apple provides instructions how to set that up with doxygen (written in the time Xcode 3 was released). For Xcode 4 there is also a nice guide how to integrate doxygen.
As of version 1.8.0, doxygen supports Markdown markup, as well a large number of additional markup commands.
With doxygen you can include documentation on the main page (#mainpage) as well as on subpages (using #subpage or #page). Inside a page you can create sections and subsections. In fact, doxygen's user manual was completely written using doxygen. Besides that, you can group classes or functions together (using #defgroup and #ingroup) and inside a class make custom sections (using #name).
Doxygen uses a configuration file as input. You can generate a template with default values using doxygen -g or use a graphical editor to create and edit one. You can also pipe options through doxygen via a script using doxygen - (see question 17 of the FAQ for an example)
Doxygen is not limited to Objective-C, it supports a large range of languages including C, C++, and Java. Doxygen is also not limited to the Mac platform, e.g. it runs on Windows and Linux too. Doxygen's output also supports more than just HTML; you can generate PDF output (via LaTeX) or RTF and man pages.
Doxygen also goes beyond pure documentation; doxygen can create various graphs and diagrams from the source code (see the dot related options). Doxygen can also create a browsable and syntax highlighted version of your code, and cross-reference that with the documentation (see the source browser related options).
Doxygen is very fast for small to medium sized projects (the diagram generation can be slow though, but nowadays runs on multiple CPU cores in parallel and graphs from one run are reused in the next run).
For very large projects (e.g. millions of lines of code) doxygen allows the projects to be split into multiple parts and can then link the parts together as I explained here.
A nice real-life example of using doxygen for Objective-C can be found here.
The development of doxygen highly depends on user feedback. We have an active mailing list for questions and discussions and a bug tracker for both bugs and feature requests.
Most users of doxygen use it for C and C++ code, so naturally these languages have the most mature support and the output is more tuned towards the features and needs for these languages. That said, also wishes for and issues with other languages are taken seriously.
Note that I do nearly all doxygen development and most testing on a Mac myself.
I'm the author of appledoc, so this answer may be biased :) I tried all mentioned generators though (and more) but got frustrated as none produced results I wanted to have (similar goals as you).
According your points (I only mention appledoc and doxygen, I don't recollect headerdoc that well):
Consistent look: appledoc out of the box, other need to tweak css, but probably doable.
Generation of documentation sets (for Xcode references): appledoc full support for searchable and option-clickable documentation out of the box, doxygen generates xml and makefile which you need to invoke yourself. Additionally appledoc supports published docsets out of the box.
Categories: appledoc allows you to merge categories to known classes or leave them separate, foundation & other apple class categories are listed separately in index file. doxygen: this wasn't working best when I tried it.
Custom reference pages: appledoc supports out of the box using either markdown or custom html, doxygen: you can include custom documentation to main page, don't know if you can include more pages.
Easy command line: depends how you look at it: appledoc can take all arguments through command line switches (but also supports optional global and project settings plist files) so it should be very easy to integrate with build scripts. doxygen requires usage of configuration file to setup all parameters.
Large codebases: all tools should support this, although didn't compare timewise. Also not sure if any tool supports cached values (running over previously collected data in order to save some time) - I am looking into adding this for next major release.
It's some time since I tried using other tools, so above mentioned issues with doxygen/headerdoc may have been addressed! appledoc itself also has disadvantages: like you mention there's no support for enums, structs, functions etc (there was some work done in this direction, check this fork), and it has it's own set of issues that may prevent you using it, depending your requirements.
I am currently working on major update that will cover most glaring issues, including support for enums, structs etc. I'm regularly pushing new stuff to experimental branch as soon as I finish larger chunks and make it stable enough, so you can follow the progress. But it's still very early and progress depends on my time so it may take quite a while until working solution.
Xcode 5 will now parse your comments to search for documentation and display it:
You don't have to use appledoc or doxygen anymore (at least when you don't want to export your docs). More information can be found here

Creating a plugin for code hinting

I'm working with an internally-developed scripting language that some prof and his team have created for an academic project. There's documentation that show function signatures of the existing classes, but for outsiders like me, I'm constantly referring to documentation. Also, in the summer, more helpers will join and I bet they will all suffer from the same problem. So I'd like to write something in Eclipse to help with code hinting and completion, like many languages have.
I haven't programmed eclipse add-ons before, so can someone give me hints how I would generally take the function signatures from their documentation and get code hinting from it. I realize I may need to make changes to the documentation to use it for what I need. But any hints or sample projects would be appreciated. I'm not sure how to get started.
You should have a look at Xtext. With Xtext you can define a domain specific language and generate an editor for it. Here you can find a brief tutorial.