unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Semantic font-lock for JS
@ 2020-02-04 13:59 Anand Tamariya
  0 siblings, 0 replies; only message in thread
From: Anand Tamariya @ 2020-02-04 13:59 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]

Hi,
Here's a quick peek at semantic font lock for JS.
[image: Post image]
<https://preview.redd.it/l9i4xn15wwe41.png?width=800&format=png&auto=webp&s=0cfa0f7324d0e1ff6793405966eef4faba2d85cb>

Noticeable features:

   1.

   Objects, variables and functions are highlighted differently.
   2.

   Auto-suggest supported by semantic and company

It uses following face definitions for highlighting.

(defvar semantic-format-face-alist
  `( (function . font-lock-function-name-face)
     (variable . font-lock-variable-name-face)
     (type . font-lock-type-face)
     ;; These are different between Emacsen.
     (include . ,'font-lock-constant-face)
     (package . , 'font-lock-constant-face)
     ;; Not a tag, but instead a feature of output
     (label . font-lock-string-face)
     (comment . font-lock-comment-face)
     (keyword . font-lock-keyword-face)
     (annotation . font-lock-builtin-face)
     (constant . bold)
     ;;(member . font-lock-member-face)
     (abstract . italic)
     (static . italic)
     (documentation . font-lock-doc-face)
     )

*Code:* Emacs customization (https://gitlab.com/atamariya/emacs/tree/dev)

You can follow the exact code here
https://gitlab.com/atamariya/emacs/compare/v0.5...dev

Most relevant changes are in lisp/cedet/semantic/java.el . Other minor
changes are for disabling jit-lock.

- Font lock setup : semantic-font-lock-mode()

- Fontify region function: semantic-fontify-region()

- Helper function: semantic-fontify-tag()

Regards,

Anand

[-- Attachment #2: Type: text/html, Size: 3513 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-04 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 13:59 Semantic font-lock for JS Anand Tamariya

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).