mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-19 23:17:16 +03:00
477b075db5
To make https://github.com/atom-community/atom/pull/386 reviewable, that pr will be separated into many simpler prs. This is one of them. This first commit does the following: - update package.json - update package-lock.json using `./script/build` which also seems to update `apm/package-lock.json` - update packages/README.md - clone all language packages. Specifically: - `mkdir packages/language-<all of them>` - `cd packages/about` - For all languages: - `cd ../language-<>` - `git clone language-<>` - Move all files except `.git` from `language-<>/language-<>` to `language-<>` - delete `language-<>/language-<>` Since at first I accidentally updated `dependencies` then `packageDependencies`, it appears that since the versions of language-c, language-css, language-go, language-javascript, and language-sass don't match, `dependencies` was reset for those versions. [Those repos just happen to be precisely the ones that have tree-sitter v19](https://github.com/icecream17/atom-update-backlog/blob/main/Languages.md), (sans language-sass), which [currently breaks atom](https://github.com/atom/atom/issues/22129). So even though their repos are now in `packages`, **I've decided to not use them**. This is done by updating `packageDependencies` only for non-breaking languages.
50 lines
1.7 KiB
CoffeeScript
50 lines
1.7 KiB
CoffeeScript
# Run this to update the list of builtin less functions
|
|
|
|
path = require 'path'
|
|
request = require 'request'
|
|
Promise = require 'bluebird'
|
|
CSON = require 'season'
|
|
|
|
FunctionsURL = 'https://raw.githubusercontent.com/less/less-docs/master/content/functions/data/functions.json'
|
|
|
|
functionsPromise = new Promise (resolve) ->
|
|
request {json: true, url: FunctionsURL}, (error, response, properties) ->
|
|
if error?
|
|
console.error(error.message)
|
|
resolve(null)
|
|
if response.statusCode isnt 200
|
|
console.error("Request failed: #{response.statusCode}")
|
|
resolve(null)
|
|
resolve(properties)
|
|
|
|
functionsPromise.then (results) ->
|
|
suggestions = []
|
|
for functionType, functions of results
|
|
for func in functions
|
|
suggestions.push
|
|
type: 'function'
|
|
rightLabel: 'Less Builtin'
|
|
snippet: sanitizeFunc(func.example)
|
|
description: func.description
|
|
descriptionMoreURL: "http://lesscss.org/functions/##{functionType}-#{func.name}"
|
|
|
|
configPath = path.join(__dirname, 'settings', 'language-less.cson')
|
|
config = CSON.readFileSync(configPath)
|
|
builtins = config['.source.css.less .meta.property-value'].autocomplete.symbols.builtins
|
|
builtins.suggestions = suggestions
|
|
CSON.writeFileSync(configPath, config)
|
|
|
|
sanitizeFunc = (functionExample) ->
|
|
functionExample = functionExample.replace(';', '')
|
|
functionExample = functionExample.replace(/\[, /g, ', [')
|
|
functionExample = functionExample.replace(/\,] /g, '], ')
|
|
|
|
argsRe = /\(([^\)]+)\)/
|
|
functionExample = functionExample.replace argsRe, (args) ->
|
|
args = argsRe.exec(args)[1]
|
|
args = args.split(',')
|
|
args = ("${#{index + 1}:#{arg.trim()}}" for arg, index in args)
|
|
"(#{args.join(', ')})${#{index+1}:;}"
|
|
|
|
"#{functionExample}$0"
|