├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── __init__.py ├── build └── update.js ├── completions.py ├── gif ├── attributes.gif └── classes.gif ├── main.py ├── messages.json ├── messages └── 2.0.0.txt └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### 2.0.1 (January 19, 2017) 4 | - added missing files 5 | 6 | ### 2.0.0 (January 19, 2017) 7 | - updated for UIkit 3 8 | - removed snippets, because none exists for UIkit 3 at this point 9 | - added build script 10 | 11 | ### 1.13.0 (February 25, 2015) 12 | - updated for UIkit 2.25.0 13 | 14 | ### 1.12.0 (April 29, 2015) 15 | - updated for UIkit 2.20.1 16 | 17 | ### 1.11.0 (April 20, 2015) 18 | - updated for UIkit 2.19.0 19 | 20 | ### 1.10.0 (March 31, 2015) 21 | - updated for UIkit 2.18.0 22 | - fixed completions not working when inside first class attribute of a document (issue #6) 23 | 24 | ### 1.9.0 (February 9, 2015) 25 | - updated for UIkit 2.17.0 26 | 27 | ### 1.8.0 (December 8, 2014) 28 | - updated for UIkit 2.13.1 29 | 30 | ### 1.7.0 (October 7, 2014) 31 | - updated for UIkit 2.11.0 32 | 33 | ### 1.6.0 (August 8, 2014) 34 | - updated for UIkit 2.9.0 35 | - added markup snippets (triggered when typing `uikit`) 36 | 37 | ### 1.5.0 (June 6, 2014) 38 | - updated for UIkit 2.7.0 39 | 40 | ### 1.4.0 (May 9, 2014) 41 | - updated for UIkit 2.6.0 42 | 43 | ### 1.3.0 (March 25, 2014) 44 | - updated for UIkit 2.5.0 45 | 46 | ### 1.2.0 (March 5, 2014) 47 | - updated for UIkit 2.4.0 48 | - included addons 49 | 50 | ### 1.1.0 (February 21, 2014) 51 | - updated for UIkit 2.3.1 52 | 53 | ### 1.0.0 (January 24, 2014) 54 | - initial release 55 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) YOOtheme GmbH 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | uikit-sublime 2 | ============= 3 | 4 | ### UIkit Sublime Plugin 5 | 6 | Auto-complete plugin for UIKit classes and attributes. 7 | 8 | ### UIkit 9 | 10 | UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. 11 | 12 | * Homepage: [http://www.getuikit.com](http://www.getuikit.com) 13 | * Twitter: [@getuikit](http://twitter.com/getuikit) 14 | 15 | ### Installation 16 | 17 | The plugin can be installed through Sublime Text's Package Control. Just search for [UIkit autocomplete](https://sublime.wbond.net/packages/UIkit%20autocomplete). 18 | 19 | Alternatively, you can clone this repository to the Packages directory of your Sublime installation. In Mac OS, this looks as follows: 20 | 21 | ```bash 22 | cd ~/Library/Application Support/Sublime Text 3/Packages/ 23 | git clone git@github.com:uikit/uikit-sublime.git 24 | ``` 25 | 26 | ### Usage 27 | 28 | **Class name autocompletion**: When inside double quotes of a class attribute (`class="[HERE]"`), suggestions will appear for all `uk-` classes. 29 | 30 | ![animation of class autocompletion](gif/classes.gif) 31 | 32 | **Component attributes autocompletion**: When inside a tag, but outside of a quoted attribute string (`
`), suggestions will appear for all `uk-` attributes. 33 | 34 | ![animation of attributes autocompletion](gif/attributes.gif) 35 | 36 | **Note**: In order for the suggestions to appear, your document needs to have the syntax set to `HTML` (or any child syntax like `HTML (PHP)`). You can set the syntax from the menu *View > Syntax* or via the Command Palette. 37 | 38 | ### Developer 39 | 40 | *The following information explains how this plugin is maintained. Users do not need to care about those steps.* 41 | 42 | To keep this plugin in sync with UIkit, class names and attributes are extracted from the UIkit code base using the included npm script. 43 | 44 | ```bash 45 | npm install 46 | npm run update 47 | ``` 48 | 49 | To make a new version of the plugin available via package control, a new version tag needs to be created. 50 | 51 | ## Copyright and license 52 | 53 | Copyright 2017 [YOOtheme](http://www.yootheme.com) GmbH under the [MIT license](LICENSE.md). 54 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uikit/uikit-sublime/8efd36dfae1f094527197a48ca9d266f02554285/__init__.py -------------------------------------------------------------------------------- /build/update.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | // file paths 4 | var fname_css = "uikit/dist/css/uikit.css"; 5 | var fname_js = "uikit/dist/js/uikit.js"; 6 | var outfile = "completions.py"; 7 | 8 | if (!fs.existsSync(fname_css) || !fs.existsSync(fname_js)) { 9 | console.log("Make sure to build UIkit before running this task"); 10 | return; 11 | } 12 | 13 | // returns the array with all duplicate elements removed 14 | function remove_duplicates(arr) { 15 | var _set = {}; 16 | arr.forEach(function(el) { _set[el] = true; }); 17 | return Object.keys(_set); 18 | } 19 | 20 | // turn js array into a string of valid python code 21 | function pylist(classes) { 22 | var result = []; 23 | classes.forEach(function(cls, i) { 24 | 25 | // wrap class name in double quotes, add comma (except for last element) 26 | result.push(['"', cls, '"', (i !== classes.length-1 ? ", " : "")].join('')); 27 | 28 | // break lines every n elements 29 | if ((i !== 0) && (i%20 === 0)) result.push("\n "); 30 | }); 31 | return "[" + result.join("") + "]"; 32 | }; 33 | 34 | // classes: uk-* from CSS 35 | function css(done) { 36 | 37 | var css = fs.readFileSync(fname_css).toString(), 38 | classes = css.match(/\.(uk-[a-z\d\-]+)/g), 39 | classes = remove_duplicates(classes).map(function(cls) { return cls.substr(1); }), // remove leading dot 40 | pylst = pylist(classes), 41 | pystr = `classes = ${pylst}\n`; 42 | 43 | return pystr; 44 | } 45 | 46 | // data attributes: data-uk-* from JS 47 | function js(done) { 48 | 49 | var js = fs.readFileSync(fname_js).toString(), 50 | attrs = js.match(/uk-[a-z\d\-]+/g), 51 | pylst = pylist(remove_duplicates(attrs)) 52 | pystr = `attributes = ${pylst}\n`; 53 | 54 | return pystr; 55 | } 56 | 57 | function sublime() { 58 | var _css = css(), 59 | _js = js(), 60 | pystring = `${_css}\n${_js}`; 61 | 62 | fs.writeFileSync(outfile, pystring); 63 | console.log("Done."); 64 | } 65 | 66 | sublime(); 67 | -------------------------------------------------------------------------------- /completions.py: -------------------------------------------------------------------------------- 1 | # copy & paste into sublime plugin code: 2 | classes = ["uk-link", "uk-h1", "uk-h2", "uk-h3", "uk-h4", "uk-h5", "uk-h6", "uk-hr", "uk-link-muted", "uk-link-reset", "uk-heading-primary", "uk-heading-divider", "uk-heading-bullet", "uk-heading-line", "uk-divider-icon", "uk-divider-small", "uk-list", "uk-list-divider", "uk-list-striped", "uk-list-bullet", "uk-list-large", 3 | "uk-description-list", "uk-description-list-divider", "uk-table", "uk-active", "uk-table-middle", "uk-table-striped", "uk-table-hover", "uk-table-small", "uk-table-shrink", "uk-table-expand", "uk-table-link", "uk-icon", "uk-preserve", "uk-icon-image", "uk-icon-link", "uk-icon-button", "uk-input", "uk-select", "uk-textarea", "uk-radio", 4 | "uk-checkbox", "uk-fieldset", "uk-form-small", "uk-form-large", "uk-form-danger", "uk-form-success", "uk-form-blank", "uk-form-width-xsmall", "uk-form-width-small", "uk-form-width-medium", "uk-form-width-large", "uk-legend", "uk-form-custom", "uk-form-label", "uk-form-stacked", "uk-form-horizontal", "uk-form-controls", "uk-form-controls-text", "uk-form-icon", "uk-form-icon-flip", 5 | "uk-button", "uk-button-default", "uk-button-primary", "uk-button-secondary", "uk-button-danger", "uk-button-small", "uk-button-large", "uk-button-text", "uk-button-link", "uk-button-group", "uk-section", "uk-section-xsmall", "uk-section-small", "uk-section-large", "uk-section-xlarge", "uk-section-default", "uk-section-muted", "uk-section-primary", "uk-section-secondary", "uk-container", 6 | "uk-container-small", "uk-container-large", "uk-container-expand", "uk-grid", "uk-grid-margin", "uk-grid-small", "uk-grid-margin-small", "uk-grid-medium", "uk-grid-margin-medium", "uk-grid-large", "uk-grid-margin-large", "uk-grid-collapse", "uk-grid-divider", "uk-first-column", "uk-grid-stack", "uk-grid-match", "uk-card", "uk-card-body", "uk-card-header", "uk-card-footer", 7 | "uk-card-title", "uk-card-badge", "uk-card-hover", "uk-card-default", "uk-card-primary", "uk-card-secondary", "uk-card-small", "uk-card-large", "uk-nav-default", "uk-nav-header", "uk-nav-divider", "uk-nav-sub", "uk-close", "uk-close-large", "uk-spinner", "uk-totop", "uk-alert", "uk-alert-close", "uk-alert-primary", "uk-alert-success", 8 | "uk-alert-warning", "uk-alert-danger", "uk-badge", "uk-label", "uk-label-success", "uk-label-warning", "uk-label-danger", "uk-overlay", "uk-overlay-icon", "uk-overlay-default", "uk-overlay-primary", "uk-article", "uk-article-title", "uk-article-meta", "uk-comment-header", "uk-comment-body", "uk-comment-title", "uk-comment-meta", "uk-comment-list", "uk-comment", 9 | "uk-comment-primary", "uk-search", "uk-search-input", "uk-search-icon", "uk-search-icon-flip", "uk-search-default", "uk-search-navbar", "uk-search-large", "uk-search-toggle", "uk-nav", "uk-nav-parent-icon", "uk-parent", "uk-open", "uk-nav-primary", "uk-nav-center", "uk-navbar", "uk-navbar-container", "uk-navbar-transparent", "uk-navbar-left", "uk-navbar-right", 10 | "uk-navbar-center", "uk-navbar-nav", "uk-navbar-item", "uk-navbar-toggle", "uk-navbar-toggle-icon", "uk-navbar-subtitle", "uk-navbar-dropdown", "uk-navbar-dropdown-grid", "uk-navbar-dropdown-stack", "uk-navbar-dropdown-width-2", "uk-navbar-dropdown-width-3", "uk-navbar-dropdown-width-4", "uk-navbar-dropdown-width-5", "uk-navbar-dropdown-dropbar", "uk-navbar-dropdown-nav", "uk-navbar-dropbar", "uk-navbar-dropbar-slide", "uk-subnav", "uk-subnav-divider", "uk-subnav-pill", 11 | "uk-disabled", "uk-breadcrumb", "uk-pagination", "uk-pagination-next", "uk-pagination-previous", "uk-tab", "uk-tab-bottom", "uk-tab-left", "uk-tab-right", "uk-dropdown", "uk-slidenav", "uk-slidenav-large", "uk-slidenav-container", "uk-dotnav", "uk-dotnav-vertical", "uk-accordion", "uk-accordion-title", "uk-accordion-content", "uk-drop", "uk-drop-stack", 12 | "uk-drop-grid", "uk-dropdown-nav", "uk-dropdown-stack", "uk-dropdown-grid", "uk-modal", "uk-modal-page", "uk-modal-dialog", "uk-modal-container", "uk-modal-full", "uk-modal-lightbox", "uk-modal-body", "uk-modal-header", "uk-modal-footer", "uk-modal-title", "uk-modal-close-outside", "uk-modal-close-full", "uk-modal-caption", "uk-animation-reverse", "uk-offcanvas", "uk-offcanvas-flip", 13 | "uk-offcanvas-page", "uk-offcanvas-page-animation", "uk-offcanvas-page-overlay", "uk-offcanvas-overlay", "uk-offcanvas-bar", "uk-offcanvas-bar-animation", "uk-offcanvas-reveal", "uk-switcher", "uk-iconnav", "uk-iconnav-vertical", "uk-notification", "uk-notification-top-right", "uk-notification-bottom-right", "uk-notification-top-center", "uk-notification-bottom-center", "uk-notification-bottom-left", "uk-notification-message", "uk-notification-close", "uk-notification-message-primary", "uk-notification-message-success", 14 | "uk-notification-message-warning", "uk-notification-message-danger", "uk-tooltip", "uk-placeholder", "uk-progress", "uk-sortable", "uk-sortable-drag", "uk-sortable-placeholder", "uk-sortable-empty", "uk-sortable-handle", "uk-animation-fade", "uk-animation-scale-up", "uk-animation-scale-down", "uk-animation-slide-top", "uk-animation-slide-bottom", "uk-animation-slide-left", "uk-animation-slide-right", "uk-animation-slide-top-small", "uk-animation-slide-bottom-small", "uk-animation-slide-left-small", 15 | "uk-animation-slide-right-small", "uk-animation-slide-top-medium", "uk-animation-slide-bottom-medium", "uk-animation-slide-left-medium", "uk-animation-slide-right-medium", "uk-animation-kenburns", "uk-animation-shake", "uk-animation-fast", "uk-animation-toggle", "uk-hover", "uk-child-width-1-2", "uk-child-width-1-3", "uk-child-width-1-4", "uk-child-width-1-5", "uk-child-width-1-6", "uk-child-width-auto", "uk-child-width-expand", "uk-child-width-1-1", "uk-width-1-2", "uk-width-1-3", 16 | "uk-width-2-3", "uk-width-1-4", "uk-width-3-4", "uk-width-1-5", "uk-width-2-5", "uk-width-3-5", "uk-width-4-5", "uk-width-1-6", "uk-width-5-6", "uk-width-small", "uk-width-medium", "uk-width-large", "uk-width-xlarge", "uk-width-xxlarge", "uk-width-auto", "uk-width-expand", "uk-width-1-1", "uk-text-lead", "uk-text-meta", "uk-text-small", 17 | "uk-text-large", "uk-text-bold", "uk-text-uppercase", "uk-text-capitalize", "uk-text-lowercase", "uk-text-muted", "uk-text-primary", "uk-text-success", "uk-text-warning", "uk-text-danger", "uk-text-left", "uk-text-right", "uk-text-center", "uk-text-justify", "uk-text-top", "uk-text-middle", "uk-text-bottom", "uk-text-baseline", "uk-text-nowrap", "uk-text-truncate", 18 | "uk-text-break", "uk-column-divider", "uk-column-1-2", "uk-column-1-3", "uk-column-1-4", "uk-column-1-5", "uk-column-1-6", "uk-column-span", "uk-cover", "uk-cover-container", "uk-background", "uk-background-muted", "uk-background-primary", "uk-background-secondary", "uk-background-cover", "uk-background-contain", "uk-background-top-left", "uk-background-top-center", "uk-background-top-right", "uk-background-center-left", 19 | "uk-background-center-center", "uk-background-center-right", "uk-background-bottom-left", "uk-background-bottom-center", "uk-background-bottom-right", "uk-background-norepeat", "uk-background-fixed", "uk-background-image", "uk-background-blend-multiply", "uk-background-blend-screen", "uk-background-blend-overlay", "uk-background-blend-darken", "uk-background-blend-lighten", "uk-background-blend-color-dodge", "uk-background-blend-color-burn", "uk-background-blend-hard-light", "uk-background-blend-soft-light", "uk-background-blend-difference", "uk-background-blend-exclusion", "uk-background-blend-hue", 20 | "uk-background-blend-saturation", "uk-background-blend-color", "uk-background-blend-luminosity", "uk-align-center", "uk-align-left", "uk-align-right", "uk-panel", "uk-panel-scrollable", "uk-clearfix", "uk-float-left", "uk-float-right", "uk-overflow-hidden", "uk-overflow-auto", "uk-resize", "uk-resize-vertical", "uk-display-block", "uk-display-inline", "uk-display-inline-block", "uk-inline-clip", "uk-height-1-1", 21 | "uk-height-viewport", "uk-height-small", "uk-height-medium", "uk-height-large", "uk-height-max-small", "uk-height-max-medium", "uk-height-max-large", "uk-preserve-width", "uk-responsive-width", "uk-responsive-height", "uk-border-circle", "uk-border-rounded", "uk-box-shadow-small", "uk-box-shadow-medium", "uk-box-shadow-large", "uk-box-shadow-xlarge", "uk-dropcap", "uk-logo", "uk-logo-inverse", "uk-svg", 22 | "uk-drag", "uk-dragover", "uk-blend-multiply", "uk-blend-screen", "uk-blend-overlay", "uk-blend-darken", "uk-blend-lighten", "uk-blend-color-dodge", "uk-blend-color-burn", "uk-blend-hard-light", "uk-blend-soft-light", "uk-blend-difference", "uk-blend-exclusion", "uk-blend-hue", "uk-blend-saturation", "uk-blend-color", "uk-blend-luminosity", "uk-transform-origin-top-left", "uk-transform-origin-top-center", "uk-transform-origin-top-right", 23 | "uk-transform-origin-center-left", "uk-transform-origin-center-right", "uk-transform-origin-bottom-left", "uk-transform-origin-bottom-center", "uk-transform-origin-bottom-right", "uk-flex", "uk-flex-inline", "uk-flex-left", "uk-flex-center", "uk-flex-right", "uk-flex-between", "uk-flex-around", "uk-flex-stretch", "uk-flex-top", "uk-flex-middle", "uk-flex-bottom", "uk-flex-row", "uk-flex-row-reverse", "uk-flex-column", "uk-flex-column-reverse", 24 | "uk-flex-nowrap", "uk-flex-wrap", "uk-flex-wrap-reverse", "uk-flex-wrap-stretch", "uk-flex-wrap-top", "uk-flex-wrap-middle", "uk-flex-wrap-bottom", "uk-flex-wrap-between", "uk-flex-wrap-around", "uk-flex-first", "uk-flex-last", "uk-flex-none", "uk-flex-auto", "uk-flex-1", "uk-margin", "uk-margin-top", "uk-margin-bottom", "uk-margin-left", "uk-margin-right", "uk-margin-small", 25 | "uk-margin-small-top", "uk-margin-small-bottom", "uk-margin-small-left", "uk-margin-small-right", "uk-margin-medium", "uk-margin-medium-top", "uk-margin-medium-bottom", "uk-margin-medium-left", "uk-margin-medium-right", "uk-margin-large", "uk-margin-large-top", "uk-margin-large-bottom", "uk-margin-large-left", "uk-margin-large-right", "uk-margin-xlarge", "uk-margin-xlarge-top", "uk-margin-xlarge-bottom", "uk-margin-xlarge-left", "uk-margin-xlarge-right", "uk-margin-remove", 26 | "uk-margin-remove-top", "uk-margin-remove-bottom", "uk-margin-remove-left", "uk-margin-remove-right", "uk-margin-remove-vertical", "uk-margin-remove-adjacent", "uk-margin-auto", "uk-margin-auto-left", "uk-margin-auto-right", "uk-margin-auto-vertical", "uk-padding", "uk-padding-small", "uk-padding-large", "uk-padding-remove", "uk-padding-remove-top", "uk-padding-remove-bottom", "uk-padding-remove-vertical", "uk-padding-remove-horizontal", "uk-position-top", "uk-position-bottom", 27 | "uk-position-left", "uk-position-right", "uk-position-top-left", "uk-position-top-right", "uk-position-bottom-left", "uk-position-bottom-right", "uk-position-center", "uk-position-center-left", "uk-position-center-right", "uk-position-top-center", "uk-position-bottom-center", "uk-position-cover", "uk-position-relative", "uk-position-absolute", "uk-position-fixed", "uk-position-z-index", "uk-position-small", "uk-position-medium", "uk-transition-fade", "uk-transition-toggle", 28 | "uk-transition-scale-up", "uk-transition-scale-down", "uk-transition-slide-top", "uk-transition-slide-bottom", "uk-transition-slide-left", "uk-transition-slide-right", "uk-transition-slide-top-small", "uk-transition-slide-bottom-small", "uk-transition-slide-left-small", "uk-transition-slide-right-small", "uk-transition-slide-top-medium", "uk-transition-slide-bottom-medium", "uk-transition-slide-left-medium", "uk-transition-slide-right-medium", "uk-transition-opaque", "uk-transition-slow", "uk-hidden", "uk-visible", "uk-invisible", "uk-visible-toggle", 29 | "uk-hidden-hover", "uk-invisible-hover", "uk-light", "uk-preserve-color"] 30 | 31 | attributes = ["uk-transition", "uk-animation-leave", "uk-animation-enter", "uk-animation-", "uk-animation-reverse", "uk-no-boot", "uk-open", "uk-accordion-title", "uk-accordion-content", "uk-alert-close", "uk-animation-fade", "uk-focus", "uk-hover", "uk-grid-margin", "uk-grid-stack", "uk-animation-toggle", "uk-transition-toggle", "uk-icon", "uk-margin-small-top", "uk-first-column", "uk-modal-page", 32 | "uk-modal-dialog", "uk-modal-close", "uk-modal-close-default", "uk-modal-close-outside", "uk-modal-close-full", "uk-flex", "uk-flex-center", "uk-flex-middle", "uk-modal", "uk-modal-body", "uk-modal-footer", "uk-text-right", "uk-button", "uk-button-primary", "uk-button-default", "uk-form-stacked", "uk-input", "uk-parent", "uk-navbar-nav", "uk-navbar-dropdown", 33 | "uk-navbar-dropbar", "uk-navbar-dropbar-slide", "uk-offcanvas-page", "uk-offcanvas-bar", "uk-offcanvas-flip", "uk-offcanvas-page-animation", "uk-offcanvas-bar-animation", "uk-offcanvas", "uk-offcanvas-overlay", "uk-offcanvas-page-overlay", "uk-offcanvas-close", "uk-scrollspy-inview", "uk-scrollspy-class", "uk-active", "uk-sticky-placeholder", "uk-switcher", "uk-switcher-item", "uk-disabled", "uk-tab-item", "uk-tab-left", 34 | "uk-tab-right", "uk-lightbox-item", "uk-transition-hide", "uk-transition-show", "uk-close", "uk-position-center", "uk-modal-lightbox", "uk-modal-caption", "uk-dark", "uk-light", "uk-position-center-left", "uk-slidenav", "uk-position-center-right", "uk-slidenav-position", "uk-position-cover", "uk-responsive-width", "uk-notification", "uk-notification-", "uk-notification-message", "uk-notification-message-", 35 | "uk-notification-close", "uk-sortable-item", "uk-sortable-placeholder", "uk-sortable-drag", "uk-drag", "uk-sortable", "uk-sortable-nodrag", "uk-sortable-empty", "uk-animation-scale-up", "uk-tooltip", "uk-dragover"] 36 | -------------------------------------------------------------------------------- /gif/attributes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uikit/uikit-sublime/8efd36dfae1f094527197a48ca9d266f02554285/gif/attributes.gif -------------------------------------------------------------------------------- /gif/classes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uikit/uikit-sublime/8efd36dfae1f094527197a48ca9d266f02554285/gif/classes.gif -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import sublime_plugin 2 | import sublime 3 | from .completions import classes, attributes 4 | 5 | class UIkitCompletions(sublime_plugin.EventListener): 6 | """ 7 | Provide tag completions for UIkit elements and data-uk attributes 8 | """ 9 | def __init__(self): 10 | 11 | self.class_completions = [("%s \tUIkit class" % s, s) for s in classes] 12 | self.data_completions = [("%s \t UIkit uk-data" % s, "%s=\"$1\"" % s) for s in attributes] 13 | 14 | def on_query_completions(self, view, prefix, locations): 15 | 16 | if view.match_selector(locations[0], "text.html string.quoted"): 17 | 18 | # Cursor is inside a quoted attribute 19 | # Now check if we are inside the class attribute 20 | 21 | # max search size 22 | LIMIT = 250 23 | 24 | # place search cursor one word back 25 | cursor = locations[0] - len(prefix) - 1 26 | 27 | # dont start with negative value 28 | start = max(0, cursor - LIMIT - len(prefix)) 29 | 30 | # get part of buffer 31 | line = view.substr(sublime.Region(start, cursor)) 32 | 33 | # split attributes 34 | parts = line.split('=') 35 | 36 | # is the last typed attribute a class attribute? 37 | if len(parts) > 1 and parts[-2].strip().endswith("class"): 38 | return self.class_completions 39 | else: 40 | return [] 41 | elif view.match_selector(locations[0], "text.html meta.tag - text.html punctuation.definition.tag.begin"): 42 | 43 | # Cursor is in a tag, but not inside an attribute, i.e.
44 | # This one is easy, just return completions for the data-uk-* attributes 45 | return self.data_completions 46 | 47 | else: 48 | 49 | return [] 50 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "2.0.0": "messages/2.0.0.txt" 3 | } 4 | -------------------------------------------------------------------------------- /messages/2.0.0.txt: -------------------------------------------------------------------------------- 1 | UIkit autocompletion plugin 2 | === 3 | 4 | Class names and attributes have been updated to the new UIkit 3. 5 | Note that some are new and many have changed. 6 | Documentation for the new markup can be found on getuikit.com 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uikit-sublime", 3 | "version": "2.0.0", 4 | "description": "Sublime plugin with autocompletions for the UIkit frontent framework", 5 | "scripts": { 6 | "update": "git clone git@github.com:uikit/uikit.git && node build/update && rm -rf uikit" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/uikit/uikit-sublime.git" 11 | }, 12 | "keywords": [ 13 | "sublime", 14 | "uikit", 15 | "autocompletion" 16 | ], 17 | "author": "YOOtheme", 18 | "license": "MIT", 19 | "bugs": { 20 | "url": "https://github.com/uikit/uikit-sublime/issues" 21 | }, 22 | "homepage": "https://github.com/uikit/uikit-sublime#readme", 23 | "dependencies": { 24 | "fs": "0.0.1-security" 25 | }, 26 | "private": true 27 | } 28 | --------------------------------------------------------------------------------