zazuko / xrm

A friendly language for mappings to RDF
MIT License
1 stars 0 forks source link

code-template for e.g. creating a new dialect #101

Open nnamtug opened 3 years ago

nnamtug commented 3 years ago

Code completion helps to create or modify elements. When it comes to create new elements, this sometimes is not enough. This applies e.g. when creating a new 'dialect' - it consist of a lot of optional keywords. One could support the user by providing a template: When hitting CTRL space at a location where the keyword 'dialect' is applicable, the user will be offered to complete with not only the keyword dialect, but with a complete example for a dialect. As a user the template allows you to navigate through the variables by hitting TAB and to accept or change the suggested values:

dialect UniqDialect {
    delimiter "${delimiter:,}"
    commentPrefix "#"
    doubleQuote true
    encoding "utf-8"
    header true
    headerRowCount 1
    lineTerminators "\\r\\n"
    quoteChar '${quoteChar:\\"}'
    skipBlankRows false
    skipColumns 0
    skipInitialSpace false
    skipRows 0
    trim false
}

@mchlrch Is there a reasonable set of dialect properties to put into a template? Or are maybe different flavors of templates to be offered?

mchlrch commented 3 years ago

For the dialect, the flavors "common" and "full" could be offered:

common:

dialect UniqDialect {
    delimiter "${delimiter:,}"
    encoding "utf-8"
    header true
    quoteChar '${quoteChar:\\"}'
}

Including more templates in the editor is generally a good idea. There's issue #6 related to that as well