adrianlee44 / atom-aligner

Easily align multi-line with support for different operators and custom configurations
https://atom.io/packages/aligner
MIT License
78 stars 3 forks source link

Uncaught TypeError: Cannot assign to read only property 'row' of object '[object Object]' #85

Closed francis-de-ladu closed 1 year ago

francis-de-ladu commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.45.0 x64 Electron: 4.2.7 OS: Linux Mint Thrown From: aligner package 1.2.4

Stack Trace

Uncaught TypeError: Cannot assign to read only property 'row' of object '[object Object]'

At /usr/share/atom/resources/app/static/<embedded>:11

TypeError: Cannot assign to read only property 'row' of object '[object Object]'
    at TreeSitterLanguageMode.tokenizedLineForRow (/usr/share/atom/resources/app/static/<embedded>:11:3126588)
    at getTokenizedLineForBufferRow (/packages/aligner/lib/helper.js:304:26)
    at Object.getAlignCharacter (/packages/aligner/lib/helper.js:47:19)
    at _traverseRanges (/packages/aligner/lib/helper.js:80:26)
    at _traverseRanges (/packages/aligner/lib/helper.js:17:20)
    at Object.getAlignCharacterInRanges (/packages/aligner/lib/helper.js:79:10)
    at Aligner.alignRanges (/packages/aligner/lib/main.js:53:30)
    at Aligner.align (/packages/aligner/lib/main.js:35:12)
    at HTMLElement.disposables.add.atom.commands.add (/packages/aligner/lib/main.js:74:12)
    at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/static/<embedded>:11:349290)
    at KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/static/<embedded>:11:1254747)
    at KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/static/<embedded>:11:1250881)
    at WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app/static/<embedded>:11:284496)

Commands

  3x -1:36.3.0 aligner:align (input.hidden-input)
     -1:34.8.0 core:move-up (input.hidden-input)
 10x -1:33.9.0 aligner:align (input.hidden-input)
     -1:30.9.0 core:save (input.hidden-input)
  2x -1:25.6.0 aligner:align (input.hidden-input)
     -0:20.3.0 core:select-all (input.hidden-input)
     -0:19.6.0 aligner:align (input.hidden-input)
     -0:06.6.0 core:save (input.hidden-input)
  2x -0:04.6.0 aligner:align (input.hidden-input)
     -0:03.8.0 core:select-all (input.hidden-input)
     -0:03.3.0 aligner:align (input.hidden-input)

Non-Core Packages

aligner 1.2.4 
aligner-javascript 1.3.0 
aligner-python 1.2.0 
atom-beautify 0.33.4 
docblock-python 0.18.1 
ide-python 1.5.0 
python-docstring 0.0.3 
python-indent 1.2.6 
adrianlee44 commented 4 years ago

Hi @francis-de-ladu, are you trying to align python and is it possible to share a sample snippet of the code you are trying to align?

francis-de-ladu commented 4 years ago
import argparse
import pandas as pd
import tweepy
import sys

from TwitterApi import ApiHandle

# Api keys to be used to authenticate to Twitter's api.
API_KEY = "API_KEY"
API_SECRET = "API_SECRET"

api = ApiHandle(API_KEY, API_SECRET)

attributes = {
    'id_str': 'id_str',
    'created_at': 'created_at',
    'author_screen_name': ['author', 'screen_name'],
    'author_id_str': ['author', 'id_str'],
    'source': 'source',
    'lang': 'lang',
    'full_text': 'full_text',
    'favorite_count': 'favorite_count',
    'retweet_count': 'retweet_count',
    'is_quote_status': 'is_quote_status',
    'quoted_status_id_str': 'quoted_status_id_str',
    'in_reply_to_screen_name': 'in_reply_to_screen_name',
    'in_reply_to_status_id_str': 'in_reply_to_status_id_str',
    'entities': 'entities',
    # 'retweets': 'retweets',
    # NEED INVESTIGATION
    # 'quoted_status': 'quoted_status',
    # 'retweeted_status': 'retweeted_status',
    # OBJECTS
    # 'coordinates': 'coordinates',
    # 'geo': 'geo',
    # 'place': 'place',
}

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description='Script to fetch tweets from the last seven days according to some criterion.')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('--user', metavar='username', type=str, default=None,
                       help='the user from whom to fetch the tweets')
    group.add_argument('--text', metavar='text_query', type=str, default=None,
                       help='the string to look for to fetch the tweets')
    group.add_argument('--ids', metavar='N', type=int, nargs='+', default=None,
                       help='a list of tweet IDs to fetch')
    parser.add_argument('--count', metavar='N', type=int, default=100,
                        help='the number of tweets to fetch (default 100)')

    args = parser.parse_args()
    print(args)

    if args.user:
        api.tweets_from_username(
            username=args.user, count=args.count, attributes=attributes)
    elif args.text:
        api.tweets_from_text_query(
            text_query=args.text, count=args.count, attributes=attributes)
    elif args.ids:
        api.tweets_from_ids(ids=args.ids, attributes=attributes)
    else:
        raise "This should never happen!"
francis-de-ladu commented 4 years ago

The problem doesn't happen when I remove what's commented inside the brackets, but it still doesn't align colons as expected.