GithubHelp home page GithubHelp logo

language-python's Introduction

Atom

Build status

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

Atom is a hackable text editor for the 21st century, built on Electron, and based on everything we love about our favorite editors. We designed it to be deeply customizable, but still approachable using the default configuration.

Atom

Atom Screenshot

Visit atom.io to learn more or visit the Atom forum.

Follow @AtomEditor on Twitter for important announcements.

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Documentation

If you want to read about using Atom or developing packages in Atom, the Atom Flight Manual is free and available online. You can find the source to the manual in atom/flight-manual.atom.io.

The API reference for developing packages is also documented on Atom.io.

Installing

Prerequisites

macOS

Download the latest Atom release.

Atom will automatically update when a new release is available.

Windows

Download the latest Atom installer. AtomSetup.exe is 32-bit. For 64-bit systems, download AtomSetup-x64.exe.

Atom will automatically update when a new release is available.

You can also download atom-windows.zip (32-bit) or atom-x64-windows.zip (64-bit) from the releases page. The .zip version will not automatically update.

Using Chocolatey? Run cinst Atom to install the latest version of Atom.

Linux

Atom is only available for 64-bit Linux systems.

Configure your distribution's package manager to install and update Atom by following the Linux installation instructions in the Flight Manual. You will also find instructions on how to install Atom's official Linux packages without using a package repository, though you will not get automatic updates after installing Atom this way.

Archive extraction

An archive is available for people who don't want to install atom as root.

This version enables you to install multiple Atom versions in parallel. It has been built on Ubuntu 64-bit, but should be compatible with other Linux distributions.

  1. Install dependencies (on Ubuntu):
sudo apt install git libasound2 libcurl4 libgbm1 libgcrypt20 libgtk-3-0 libnotify4 libnss3 libglib2.0-bin xdg-utils libx11-xcb1 libxcb-dri3-0 libxss1 libxtst6 libxkbfile1
  1. Download atom-amd64.tar.gz from the Atom releases page.
  2. Run tar xf atom-amd64.tar.gz in the directory where you want to extract the Atom folder.
  3. Launch Atom using the installed atom command from the newly extracted directory.

The Linux version does not currently automatically update so you will need to repeat these steps to upgrade to future releases.

Building

Discussion

License

MIT

When using the Atom or other GitHub logos, be sure to follow the GitHub logo guidelines.

language-python's People

Contributors

50wliu avatar aminya avatar aroben avatar ben3eee avatar caleb531 avatar cronos87 avatar darangi avatar daviwil avatar falcondai avatar foresmac avatar illright avatar izuzak avatar jasonrudolph avatar jrial avatar justinnoah avatar kbrose avatar kevinastone avatar kevinsawicki avatar lee-dohm avatar maxbrunsfeld avatar michaelaquilina avatar mnquintana avatar nicktimko avatar okbel avatar pchaigno avatar sadick254 avatar syndbg avatar tennyson-mccalla avatar thomasjo avatar warunsl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

language-python's Issues

Highlight for 'in' keyword

I've noticed that the in keyword doesn't have syntax highlighting:
screen shot 2015-07-04 at 10 44 12 am

It should probably have the same color as the for keyword or something...

Raw strings + convoluted escaping = broken string highlighting

Take this bit of entirely valid python code

contrived_regex = r"\*text\*\n\*text\*\n\*text\*\n\*text\*\n\*(?P<label1>.+)\n(?P<label2>.+)\n(?P<label3>.+\((?P<label4>[A-Z]*)\))\n(?P<label5>.+)\n(?P<label6>.+\((?P<label7>[A-Z]{3})\))\n(?P<label8>.+)\n(?P<label9>\d+)\n"
innocent_variable = {
  "things": 123
}

Here's what it looks like in Atom

Atom

vs. in ST2

ST2

In a few minutes of experimentation, that was the shortest I could get the troublemaking string down to. Removing the raw decorator, or removing (nearly?) any of the control characters inside it fixes the highlighting.

Edit: slightly shorter variant that produces the same result:

contrived_regex = r"\*\text\*\\*\text\*\\*\\text\\n\*\\text\*\n\*(?P<label1>.+)\n(?P<label2>.+)\n(?P<label3>.+\((?P<label4>[]*)\))\n(?P<label5>.+)\n(.+\((?P<label7>[a]{)\))\n(?P<label8>.+)\n(?P<label9>\d+)"
innocent_variable = {
  "things": 123
}

Auto indent on line continuation with list/tuple

Pressing enter after continuing a list or tuple on a second line. It should either auto indent one tab, or to the first char of the previous item, but it just goes to the beginning of the line. Manually pressing auto indent (Lines->Auto Indent, or cmd+i), doesn't do anything.

image

should be either

somefunc(bar,
    m)

or

somefunc(bar,
         m)

Python, docstring and folding

Hello.

The following docstring is not managed because its content is not indented (this is a legal use of triple quotes).

class MyClass:
    """
Here is a docstring  : bla,
bla,
bla...
    """
    def __init__(self):
        ...

Typing "\xCC" causes weird indenting / display behavior

Atom version 0.95.0. I don't really know how to describe this issue other than ... I know it's not right. So since sometimes pictures are better than words and moving pictures are better than pictures, here's the behavior in action:

http://imgur.com/koj5vAv

I've also validate that this only is an issue with the Language python one (notice the .c file that worked well).

The behavior can be reproduced with almost any escaped sequence:

test = "\xCC"

Auto-generated quote and bracket jump doesn't work with escape sequence

E.g. type ('\n, the text created will be ('\n') with the cursor just after \n.

Now if you type single quote (') the cursor will insert a new single quote, not jump to the auto-generated one.

Similarly, typing the closing bracket (() won't jump the cursor to that closing bracket, instead it'll insert a new one.

Please fix this, it's very annoying for common cases such as split('\n').

Disallow folding of try blocks

Atom allows folding this code:

try:
    print("hi")
except:
    print("uh oh")

To this:

try:
except:

Unlike folding a function or flow control block (if, while, etc), there's no context above the fold showing what is within. Additionally you end up with two top level folds which seems logically incorrect.

Folding of try/except blocks just ends up annoying me when I 'fold all' on the current file -- I'd like it not to happen.

Sage deprecation error

There's no place to report errors with the language-sage packages but this is apparently the master repo for it so I thought I'd report it here. I received this deprecation error:

Store package settings files in the settings/ directory instead of scoped-properties/

Package.loadSettings - /opt/atom/resources/app.asar/src/package.js:584:9
<unknown> - /opt/atom/resources/app.asar/src/package.js:184:43
Package.measure - /opt/atom/resources/app.asar/src/package.js:163:15
Package.load - /opt/atom/resources/app.asar/src/package.js:177:12
PackageManager.loadPackage - /opt/atom/resources/app.asar/src/package-manager.js:355:14
PackageManager.loadPackages - /opt/atom/resources/app.asar/src/package-manager.js:325:14

False positive for % formatting characters in strings

screenshot

language-python assumes that percent (%) characters always begin a C-style formatting string, though HTML-encoded strings are also common.

What's the best way to deal with this issue? Check for infix modulo % operator / .format method call? Turn C-style format highlighting off by default?

nonlocal keyword not recognised

The nonlocal keyword (new in Python 3) is not recognised as keyword. It should be recognised and treated just as the global keyword is.

Grammar tokenizeLines inconsistent when using self

It tokenizes the foo in self.foo as two tokens, f and oo, but in self.foo() it is correctly tokenized as foo. This does not happen with a.foo.

Reproduction: get a python grammar object grammar:

tokens = grammar.tokenizeLines('self.foo')
// length 4 array, tokens[2].value == 'f', tokens[3].value == 'oo'
tokens = grammar.tokenizeLines('self.foo()')
// length 5 array, tokens[2].value == 'foo'

This is version 1.0.2 of atom on OS X 10.10.2, running in --safe mode.

Allow different styling of the regex `.` wildcard and other character classes

I'm currently working on adding syntax highlighting to the find-and-replace dialog (see atom/find-and-replace#458 ) and have found that the python regex grammar works very well for this. One enhancement I'd like to make is to make . wildcard more visible by styling it bold. The problem I've run into is that the python regex grammar uses the same identifier for . as it does for other character-classes like \s, \w, etc, so I can't style . without affecting the others.

Would it be reasonable to update the regex grammar to add an additional identifier for the . wildcard? For example, constant.character.character-class.wildcard.regexp instead of constant.character.character-class.regexp?

I'll follow up with an example commit that makes this change, but would like feedback as to any potential downsides before I submit a pull request.

Respect app-wide preferences

I set my Atom app preferences to «soft tabs using two spaces» but the editor kept indenting by four. Finally I dug into the language-python settings and found that (a) it's using hard tabs despite my app wide preference to use soft tabs and (b) it's ignoring my two spaces setting and rendering the hard tabs as four spaces - both of which are super annoying if you're a bit anal about those things.

defs snippet

Why is the snippet for defining a method called defs and not simply def?

Fails to highlight comment after function arguments

language-python fails to highlight # requests... as a comment in this code block:

def __init__(
    self,
    container,
    group,
    codec=0,  # requests small enough that compression would be unnecessary overhead
    **config
):

Unclosed bracket in triple-quoted raw string breaks highlighting

This is basically the same as #37 except for triple-quoted raw strings.

screen shot 2014-11-21 at 4 38 42 pm

#foo above should be highlighted as a comment. Instead, it and everything else that comes later in the file will get highlighted as if it were a regex. The grammar doesn't see that the raw string got closed at the closing triple-quote, so is happily consuming everything into the string.

The rules for triple-quoted strings use begin/end to make them work over multiple lines. We could fix the single-line case by adding near-duplicate match rules ("match": "r\"\"\"(.*)\"\"\" e.g.). But the multi-line case would still be broken:

screen shot 2014-11-21 at 4 40 56 pm

I'm not sure how to fix the multi-line case given the way grammars currently work.

Snippet for "class" leaves all sorts of gook

class produces ->

class ClassName(object):
${3/.+/"""/}hell${3/.+/"""\n/}${3/.+/\t/}def init(self${4/([^,])?(.)/(?1:, )/}arg):
super(what, self).init()
${4/(\A\s
,\s_\Z)|,?\s_([A-Za-z_][a-zA-Z0-9_])\s(=[^,])?(,\s|$)/(?2:\t\tself. = the\n)/g}

It jumps in order from where I typed "what" to "the" and then to "hell" but keeps the other stuff there.

Atom 0.60.0

update 'class' snippet to use multi-caret support

The code for class snippet should become something like this:

"class ${1:ClassName}(${2:object}):\n\t\"\"\"${3:docstring for $1}\"\"\"\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super($1, self).__init__()}\n\t\tself.arg = arg\n\t\t$0"

The fix is too trivial to make a fork and pull request, so I just open an issue.

Indentation error

Massive indentation problem in vanilla atom 0.198.0:

def testing_indentation(some_var):
    first_line = 'indentation works'
    second_line = a_function(that_has,
    lots_of,
    parameters,
    )
    third_line = another_function(
    ending_parenthesis,
    moved_to_end_correctly,
    but_matching_broken="need to move cursor manually",
    )

    fourth_line = existing_indentation('try this',
                                       'indentation test')
                                       next_line = 'still bad'
                                       no_reset = 'uh oh'

                                       'comes back here, too'
    fifth_try = existing_indentation(
        'another indentation scheme',
        'with multiple variables',
        )
        no_surprise = 'also broken'

    if indentation is not None:
        basic_indent = True
    elif indentation == "elif works?":
        basic_indent = True
        if nested is True:
            basic_indent = True
        else:
            still_works = True
        else:
            raise IndentationError

            still_indented = 'expected'    

    seventh_tr = how_about + an_uncommon + \
    but_still_valid + \
    example + '?'

Initial post here

Mistakenly highlights DELETE in quotes as keyword

language-python mistakenly highlights DELETE in:

class Call(object):
    _valid_methods = ['GET', 'POST', 'PUT', 'DELETE', 'HEAD']

as a keyword, even though it is inside quotes, indicating it is a string.

Syntax formatting for % sign and number formatting like {0:.2%}

Two string formatting issues that appear regardless of theme selected:

  1. Percent sign: Even using string.format() the syntax appears for the older % s nomenclature - first line in screenshot. A similar issue was reported in which percent signs are incorrectly colored in triple-quoted strings: #40.
  2. Number formatting changes the color: {0} appears correctly in the non-string color, but if formatting is applied {0:.2%} then it incorrectly displays in the string color - second line in screenshot.

atom_python_highlighting

a re code make atom error color

the code is:

reg_b = re.compile(r"(android|bb\d+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino", re.I|re.M)

Function Annotation (return type annotation) breaks syntax highlighting

The attached image should be pretty descriptive of the problem. The grammar just doesn't seem to support function annotation. You can see that it doesn't syntax highlight the names/string annotating foo and bar. However, including the return type annotation breaks the syntax highlighting for following sections

image

Really weird highlighting issues

Basically, I'm going to use Linguist as an example, but the same thing occurs with Atom. I'm just too lazy to take screenshots. :)

Take a look at:

All of these issues are from one file. Now, as I said, these all also occur in Atom, which makes editing Python files...fun. :/

Paste error

When i paste copied code, the indentation comes out wrong. Here is a screenshot of what it looks like after pasting.

screenshot - 06092015 - 11 50 10 am

auto-indent and auto-indent paste are on.

Support wscript as Python

The module don't regonize wscript files from WAF.
Neither with "#!/usr/bin/env python"

Any suggestions?

Tab key doesn't insert 4 spaces

I would expect any editor's Python mode to insert 4 spaces on a tab key press. Currently, when I open a .py file in atom, a tab key inserts a tab symbol. Even when I enter four spaces using the space bar, it still seems as if 2 tab keys were inserted. Am I getting something wrong maybe?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.