Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
9a271ab
use kite-installer
Nov 15, 2016
1eb708d
wire up install flow
Nov 15, 2016
0fbfb55
use latest kite-installer
Nov 15, 2016
06475e0
add useKite config flag
Nov 15, 2016
a570508
use kite-installer v0.0.5
Nov 16, 2016
86eca08
use kite-installer v0.0.6
Nov 16, 2016
6912169
bump version of kite-installer
Nov 17, 2016
c5e7d27
use [email protected]
Nov 17, 2016
9e61e2c
use [email protected]; enable/disable kite automatically
Nov 17, 2016
f79ef51
Merge branch 'master' into kite-installer
Nov 17, 2016
decdfeb
rename package
Nov 17, 2016
711ff72
use kite-installer@latest
Nov 17, 2016
861d28e
catch exception if kite is already installed
Nov 17, 2016
7577dbf
Prepare 0.1.0 release
Nov 17, 2016
bf5746f
Prepare 0.1.1 release
Nov 17, 2016
0fe7b01
Prepare 0.1.2 release
Nov 17, 2016
df68d7a
Prepare 0.2.0 release
Nov 18, 2016
ab253db
Prepare 0.3.0 release
Nov 18, 2016
a483fd1
Prepare 1.9.11 release
Nov 18, 2016
543b1a7
remove activation hooks
Nov 18, 2016
19c5132
Prepare 1.9.12 release
Nov 18, 2016
08b3b3d
use home directory for whitelisting
Nov 22, 2016
36e29e9
Prepare 1.9.13 release
Nov 22, 2016
98da6bd
Update package.json
adamsmith Nov 23, 2016
5ca95fd
Merge pull request #1 from kiteco/updated-description
adamsmith Nov 23, 2016
4c2ee71
hook up decision endpoint
itsdhung Nov 24, 2016
6ed4934
Merge branch 'master' of github.com:kiteco/autocomplete-python
itsdhung Nov 24, 2016
a799c4d
fix typo
itsdhung Nov 24, 2016
01d27b1
Update package.json
adamsmith Nov 24, 2016
40ef169
Prepare 1.9.14 release
itsdhung Nov 24, 2016
a871d35
Merge pull request #2 from kiteco/package-json-tweaks
adamsmith Nov 24, 2016
658551a
fix images; bump version
Nov 29, 2016
0460eec
bump version
Nov 29, 2016
851eba7
Prepare 1.9.17 release
Nov 29, 2016
2566647
fix enable Jedi bug
Nov 29, 2016
fff030a
Prepare 1.9.18 release
Nov 29, 2016
409239b
add mixpanel dependency
alexflint Nov 30, 2016
abef5ee
Prepare 1.10.0 release
alexflint Nov 30, 2016
b7b1c17
add in mp tracking
itsdhung Nov 30, 2016
b6fb237
change version of kite-installer
Nov 30, 2016
e85db99
Prepare 1.10.1 release
Nov 30, 2016
2cc03eb
use real throttle; turn off debug
Nov 30, 2016
8903968
Prepare 1.10.2 release
Nov 30, 2016
246623f
use [email protected]
Nov 30, 2016
260582d
Prepare 1.10.3 release
Nov 30, 2016
e67fde4
fix checkbox logic
Nov 30, 2016
1fdeb70
Prepare 1.10.4 release
Nov 30, 2016
9982dde
add event to decision
alexflint Dec 1, 2016
e5d3a4c
bump kite-installer version
alexflint Dec 1, 2016
875cfb9
set threshold to 10 seconds
alexflint Dec 1, 2016
4c8373b
shouldOfferKite
alexflint Dec 1, 2016
13f7543
remove logging
alexflint Dec 1, 2016
635c71e
fix event selection
alexflint Dec 1, 2016
f9a4eb9
disable kite if user takes too long to input email
Dec 1, 2016
8a59076
Prepare 1.10.5 release
Dec 1, 2016
483d227
double equals
alexflint Dec 1, 2016
7b2a422
Merge remote-tracking branch 'origin/master' into event_param
alexflint Dec 1, 2016
f18f3ee
Merge pull request #3 from kiteco/event_param
alexflint Dec 1, 2016
1fe4ac3
Prepare 1.10.6 release
alexflint Dec 1, 2016
424d067
disable kite if user aborts install flow
Dec 1, 2016
3277288
Prepare 1.10.7 release
Dec 1, 2016
43666af
set accountCreated callback
Dec 1, 2016
1d36a0c
Prepare 1.10.8 release
Dec 1, 2016
2c8d732
rename pluggy-mcpluginface -> autocomplete-python
Dec 1, 2016
e61de5a
turn on real tracking
Dec 1, 2016
a311eb0
forgot to save
Dec 1, 2016
b80ef99
better logging
Dec 1, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 87 additions & 2 deletions lib/main.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
window.DEBUG = false
module.exports =
config:
useKite:
type: 'boolean'
default: true
order: 0
title: 'Use Kite-powered Completions'
description: '''Kite is a cloud powered autocomplete engine. It provides
significantly more autocomplete suggestions than the legacy engine.'''
showDescriptions:
type: 'boolean'
default: true
Expand Down Expand Up @@ -108,9 +116,86 @@ module.exports =
suggestions. For example, you can use lower value to give higher priority
for snippets completions which has priority of 2.'''

activate: (state) -> require('./provider').constructor()
installation: null

activate: (state) ->
require('./provider').constructor()

firstInstall = localStorage.getItem('autocomplete-python.installed') == null
localStorage.setItem('autocomplete-python.installed', true)
longRunning = require('process').uptime() > 10
if firstInstall and longRunning
event = "installed"
else if firstInstall
event = "upgraded"
else
event = "restarted"

{
AccountManager,
AtomHelper,
DecisionMaker,
Installation,
Installer,
Metrics,
StateController
} = require 'kite-installer'
AccountManager.initClient 'alpha.kite.com', -1, true
atom.views.addViewProvider Installation, (m) => m.element
editorCfg =
UUID: localStorage.getItem('metrics.userId')
name: 'atom'
pluginCfg =
name: 'autocomplete-python'
dm = new DecisionMaker editorCfg, pluginCfg

checkKiteInstallation = () =>
if not atom.config.get 'autocomplete-python.useKite'
return
canInstall = StateController.canInstallKite()
throttle = dm.shouldOfferKite(event)
Promise.all([throttle, canInstall]).then((values) =>
atom.config.set 'autocomplete-python.useKite', true
variant = values[0]
Metrics.Tracker.name = "atom autocomplete-python install"
Metrics.Tracker.props = variant
@installation = new Installation variant
@installation.accountCreated(() =>
Metrics.Tracker.trackEvent "account created"
atom.config.set 'autocomplete-python.useKite', true
)
@installation.flowSkipped(() =>
Metrics.Tracker.trackEvent "flow aborted"
atom.config.set 'autocomplete-python.useKite', false
)
installer = new Installer()
installer.init @installation.flow
pane = atom.workspace.getActivePane()
@installation.flow.onSkipInstall () =>
atom.config.set 'autocomplete-python.useKite', false
Metrics.Tracker.trackEvent "skipped kite"
pane.destroyActiveItem()
pane.addItem @installation, index: 0
pane.activateItemAtIndex 0
, (err) =>
if err.type == 'denied'
atom.config.set 'autocomplete-python.useKite', false
else
console.log "autocomplete-python ready"
) if atom.config.get 'autocomplete-python.useKite'

checkKiteInstallation()

atom.config.onDidChange 'autocomplete-python.useKite', ({ newValue, oldValue }) =>
if newValue
checkKiteInstallation()
AtomHelper.enablePackage()
else
AtomHelper.disablePackage()

deactivate: -> require('./provider').dispose()
deactivate: ->
require('./provider').dispose()
@installation.destroy() if @installation

getProvider: -> require('./provider')

Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"name": "autocomplete-python",
"main": "./lib/main",
"version": "1.8.12",
"description": "Python packages, variables, methods and functions with their arguments autocompletion powered by Jedi",
"activationHooks": [
"language-python:grammar-used",
"MagicPython:grammar-used",
"atom-django:grammar-used"
],
"repository": "https://github.com/sadovnychyi/autocomplete-python",
"version": "1.10.8",
"description": "Python completions for packages, variables, methods, functions, with their arguments. Powered by your choice of Jedi or Kite.",
"activationHooks": [],
"repository": "https://github.com/autocomplete-python/autocomplete-python",
"license": "GPL",
"engines": {
"atom": ">=0.194.0 <2.0.0"
Expand All @@ -17,9 +13,11 @@
"atom-slick": "^2.0.0",
"atom-space-pen-views": "~2.1.0",
"fuzzaldrin-plus": "^0.3.1",
"kite-installer": "^0.4.3",
"selector-kit": "^0.1",
"space-pen": "^5.1.2",
"underscore": "^1.8.3"
"underscore": "^1.8.3",
"mixpanel": "^0.5.0"
},
"package-dependencies": {},
"providedServices": {
Expand All @@ -45,10 +43,14 @@
{
"name": "Dmitry Sadovnychyi",
"email": "[email protected]"
},
{
"name": "Daniel Hung",
"email": "[email protected]"
}
],
"bugs": {
"url": "https://github.com/sadovnychyi/autocomplete-python/issues"
"url": "https://github.com/autocomplete-python/autocomplete-python/issues"
},
"keywords": [
"python",
Expand Down
18 changes: 18 additions & 0 deletions styles/autocomplete-python.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "ui-variables";
@import "../node_modules/kite-installer/styles/styles.less";

atom-text-editor[data-grammar="source python"], :host {
.autocomplete-suggestion-list.select-list.popover-list .suggestion-description-content {
Expand Down Expand Up @@ -33,3 +34,20 @@ autocomplete-python-suggestion {
white-space: pre-wrap;
font-family: @font-family;
}

.install-flow {
.install-flow-step.install-step .row.cta-row .logo {
background-image: url('atom://autocomplete-python/node_modules/kite-installer/styles/logo.png');
}
.welcome-to-kite {
.welcome-title .title-logo {
background-image: url('atom://autocomplete-python/node_modules/kite-installer/styles/smalllogo.png');
}
.description .description-screenshot {
background-image: url('atom://autocomplete-python/node_modules/kite-installer/styles/plotscreenshot.png');
}
}
.install-flow-step.install-step .screenshot {
background-image: url('atom://autocomplete-python/node_modules/kite-installer/styles/screenshot.png');
}
}