0

Snippet to generate custom JavaScript CodeCompletion file

Tapsi 7 years ago updated 7 years ago 3

Hi guys,


I wrote a small snippet to generate custom JS code completion description files. It can be executed at runtime and parses all objects from the global object and tries to extract their API.


I know at the moment Textastic does not supports suggestion of file symbols nor project wide symbols. That's why this snippets maybe helps people to workaround that missing feature.

At the moment this snippet is very limited and only makes the method names available in the editor without any context. I plan to add the context information and maybe also the function parameters for the completion data.  


So if you're interested in this snippet, then I can share future versions of the script here. :) 




const logCompletionDescriptionData = () => {
          const getSymbols = function() {
            const getSymbolsOfObject = (obj, symbols = [], level = 0) => {
              if (level == 5) return []
              return Object
                .keys(obj)
                .filter(key => symbols.indexOf(key) === -1)
                .filter(key => isNaN(parseInt(key)))
                .map((key, i, array) => {
                  const value = obj[key]
                  if (!value) return [key]
                  
                  const isArray = Array.isArray(value)
                  const isFunction = typeof value === "function"
                  
                  if (!isArray && !isFunction) {
                    return [key].concat(getSymbolsOfObject(value, array, level + 1))
                  }
                  
                  return [key]
                })
                .reduce((a, b) => a.concat(b), [])
                .filter((value, index, self) => self.indexOf(value) === index)
                .sort((a,b) => a < b ? -1 : +1)
            }
              
            return getSymbolsOfObject(window) 
          }     
          
          const metaData = {
            "description": "BlackCats Code",
            "uuid": "DE267669-E66E-400A-ACEA-BD906DC2B813",
            "completionSets": [
              {
                "name": "js.blackcat.code",
                "strings": getSymbols()
              }
            ],
            "contexts": [
              {
                "description": "root",
                "scope": "source.js - comment - string",
                "pattern": "(?<!\\.)\\b([a-zA-Z]*)",
                "completionCaptureIndex": 1,
                "completionSetNames": [
                  "js.blackcat.code"
                ]
              }
            ]
          }
          
          console.log(JSON.stringify(metaData, null, 2))
      }




0

Bug? Textastic auto-renames files it edits?

Beau Hartshorne 7 years ago 0

On iOS 11, when I open a file from Dropbox, Textastic renames the file automatically (to lowercase). Is this necessary?

0

key features missed : search and sort files from cloud

g6w411 7 years ago 0

Dear author, 


I like Textastic, and it is my main solution to search/edit text/md files in iphone and ipad. 


After I read doc of textasticapp, I was wandering why there were still no these basic features in mature textastic. 


1. order files by LUT (last updated time) from cloud (icloud or dropbox)

2. search files by name or regex from cloud (icloud or dropbox) 


As far as I can remember, before upgrade to ios 11, #1 is available, but after upgrading to ios 11, this one is not there. 


Textastic is still the best text editor/viewer in iOS. Please consider these 2 key features. 




Best, 

Alex



0
Under review

Textastic ‘looses’ repositories from Working Copy

thomas vogelpohl 7 years ago updated by Anders Borum 7 years ago 4

Hi, I am using an iPad Air 1 with iOS 11. I can drag and drop a repo from Working Copy to Textastic and work with the code. Then after a while, I get a ‘Spinning disk’ and suddenly the file I am working on is gone and Textastic can not open any Repo any more. In the file chooser on the left side is not written Working Copy any more but something like ‘External storage provider’ or something like that.

I have no idea if this is caused by WC or Textastic.

I have seen this happening in one of the iOs Beta versions ... but it was fixed by a newer Beta.


Thanks,

Thomas

0
Under review

Is there a way to test python or swift code inside he editor

Shock9616 7 years ago updated 7 years ago 3

I would like to see an update so that I can run swift and python which are my main two languages. The HTML viewer is nice though.

0

What are the principles for time delay relays ?

Judy 8 years ago 0

I read an electronic magazine in which there is a report on what are the principles for time delay relays. After reading, I became interested in the principles for time delay relays. So I searched some related materials and information about this topic from google. Today I come to this forum to turn to you to discuss my understandings are appropriate.


Here are my personal understandings:

Power delay time The relay has a delay normally open contact, delay normally closed contact, instantaneous normally open contacts and instantaneous normally closed contacts. The principle is as follows: When the power-off delay time relay "coil" power off: delay normally open contact - after the set time after the opening delay normally closed contact - after the set time after the turn on.
Delayed relays are mainly used for DC or AC operation in a variety of protection and automatic control lines as auxiliary relays to increase the number of contacts and contact capacity. You can adjust the delay time as needed.


Delayed relays are an alternative to conventional industrial relays by reducing the energy consumption of the automatic delay load, reducing user comfort (eg, ON-OFF switches while controlling lighting and ventilation). Modular structures can provide more benefits.


Ps: Excuse me if I was wrong in words or expressions as I am a green hand in the field of time delay relays. I need continual learnings.


What is your idea ? Do you agree with my ideas ? Any of your ideas would be highly appreciated.


May someone would like to help ?


thanks in advance




0

Send Preview over AirPlay

Scott Borland 8 years ago updated 8 years ago 1

Instead of mirroring iOS device onto another display Apple TV, how about send just the preview to the second display and leave the code in editable on the iOS devise. Live update isn't necessary. It would be neat to hav

0
Under review

Connect sFTP iPad pro

Devmobnow 8 years ago updated by Alexander Blach (Developer) 8 years ago 3

I am trying to connect with the iPad pro and can't I am having troubles connecting to Bsiness cCatalyst site. Anybody else doing so. I can't seem to do it. I am confused with the auth

0

SystemVerilog highlighting is needed

Nir 8 years ago updated by Alexander Blach (Developer) 8 years ago 1