Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Many symbols without scopes #53

Closed

Description

@benogle

Most of the issues are in the way of parsing variable names.

Load this example into atom. When I say something is not tagged I mean its scope is only .source.coffee.

someFunc = (arg1, arg2, arg3=1, arg4...) ->
  aVariable = 'ok'
  anArray = new Array()
  anArray.slice()           # anArray not tagged
  anArray.otherMethod()     # anArray, otherMethod not tagged
  randomGlobal.prop.omg()   # not tagged

  functionCall(one)         # functionCall not tagged
  functionCall one          # functionCall not tagged

  anObject =
    key1: 'val1'
    key2: (one, two) ->

# Totally messes this line up
grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) ->
  if student.excellentWork  # not tagged
    "A+"
  else if student.okayStuff # not tagged
    if student.triedHard then "B" else "B-" # student.triedHard not tagged

class Animal extends Being
  constructor: (@name) ->   # @name not tagged the same as @name in the body, should be?
    @name += ' is cool'

# Ok
math =
  root:   Math.sqrt
  square: square
  cube:   (x) -> x * square x

# Ok
heredoc = """
  CoffeeScript subst test #{ 010 + 0xf / 0b10 + "nested string #{ /\n/ }"}
"""

Giving these symbols correct scopes will greatly improve the support in the coming SymbolProvider in the soon-to-be-bundled-in-core autocomplete-plus.

Activity

  1. ThaisRobba commented on May 29, 2015

    @ThaisRobba

    Regex for function calls:

    (?<!")\b(?!\b(new|of|in|then|is|isnt|and|or|if|on|off|switch|when|else|not|class|Animal|extends|[0-9])\b)\w+\b(?!\n)(?=(\s({|\[|"|'|\b(?!\b(new|of|in|then|is|isnt|and|or|if|on|off)\b)\w+\b))|(\())
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions