forked from jhipster/prettier-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
9,315 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
author: "Jordan Kiesel (@jtkiesel)" | ||
authorURL: "https://github.com/jtkiesel" | ||
title: "Prettier Java 2.5: Java 21 unnamed patterns and variables preview feature!" | ||
--- | ||
|
||
This release adds support for the Java 21 preview feature: unnamed patterns and variables ([JEP 443](https://openjdk.org/jeps/443))! | ||
|
||
<!-- truncate --> | ||
|
||
## Highlights | ||
|
||
### Support Java 21 preview feature: unnamed patterns and variables ([#620](https://github.com/jhipster/prettier-java/pull/620) by [@jtkiesel](https://github.com/jtkiesel)) | ||
|
||
We’ve added support for the Java 21 preview feature "Unnamed Patterns and Variables": | ||
|
||
#### Unnamed pattern variables | ||
|
||
<!-- prettier-ignore --> | ||
```java | ||
// Examples | ||
r instanceof Point _ | ||
|
||
``` | ||
|
||
#### Unnamed variables | ||
|
||
<!-- prettier-ignore --> | ||
```java | ||
// Example | ||
int acc = 0; | ||
for (Order _ : orders) { | ||
if (acc < LIMIT) { | ||
// ... acc++ ... | ||
} | ||
} | ||
|
||
``` | ||
|
||
## Other Changes | ||
|
||
### New entrypoint `lexAndParse` to return both tokens and CST ([#625](https://github.com/jhipster/prettier-java/pull/625) by [@max-schaefer](https://github.com/max-schaefer)) | ||
|
||
Provide an entrypoint that exposes both the CST and the underlying token array. | ||
|
||
### No longer ignore whole block when `prettier-ignore` at start ([#603](https://github.com/jhipster/prettier-java/pull/603) by [@jtkiesel](https://github.com/jtkiesel)) | ||
|
||
When a block begins with `// prettier-ignore`, only the first statement is ignored, rather than the whole block. | ||
|
||
<!-- prettier-ignore --> | ||
```java | ||
// Input | ||
void foo() { | ||
// prettier-ignore | ||
var bar = List.of( | ||
1 | ||
); | ||
|
||
var baz = 2; | ||
} | ||
|
||
// Prettier Java 2.4 | ||
void foo() { | ||
// prettier-ignore | ||
var bar = List.of( | ||
1 | ||
); | ||
|
||
var baz = 2; | ||
} | ||
|
||
// Prettier Java 2.5 | ||
void foo() { | ||
// prettier-ignore | ||
var bar = List.of( | ||
1 | ||
); | ||
|
||
var baz = 2; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Installation | ||
|
||
## Pre-requirements | ||
|
||
- Node version 10+ | ||
|
||
## Install Prettier and Prettier-Java plugin | ||
|
||
```bash | ||
# Local installation | ||
npm install prettier-plugin-java --save-dev | ||
|
||
# Or globally | ||
npm install -g prettier prettier-plugin-java | ||
``` | ||
|
||
or with yarn: | ||
|
||
```bash | ||
# Local installation | ||
yarn add prettier-plugin-java --dev | ||
|
||
# Or globally | ||
yarn global add prettier prettier-plugin-java | ||
``` | ||
|
||
Note: If you want to install the prettier-plugin-java globally, you should also install the prettier package globally. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Introduction | ||
|
||
Let's discover **Docusaurus in less than 5 minutes**. | ||
|
||
## Getting Started | ||
|
||
Get started by **creating a new site**. | ||
|
||
Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**. | ||
|
||
### What you'll need | ||
|
||
- [Node.js](https://nodejs.org/en/download/) version 18.0 or above: | ||
- When installing Node.js, you are recommended to check all checkboxes related to dependencies. | ||
|
||
## Generate a new site | ||
|
||
Generate a new Docusaurus site using the **classic template**. | ||
|
||
The classic template will automatically be added to your project after you run the command: | ||
|
||
```bash | ||
npm init docusaurus@latest my-website classic | ||
``` | ||
|
||
You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor. | ||
|
||
The command also installs all necessary dependencies you need to run Docusaurus. | ||
|
||
## Start your site | ||
|
||
Run the development server: | ||
|
||
```bash | ||
cd my-website | ||
npm run start | ||
``` | ||
|
||
The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there. | ||
|
||
The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/. | ||
|
||
Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import type * as Preset from "@docusaurus/preset-classic"; | ||
import type { Config } from "@docusaurus/types"; | ||
import { themes as prismThemes } from "prism-react-renderer"; | ||
|
||
const config: Config = { | ||
title: "Prettier Java", | ||
tagline: "Prettier code formatter plugin for Java", | ||
favicon: "img/favicon.png", | ||
trailingSlash: false, | ||
url: "https://jtkiesel.github.io", | ||
baseUrl: "/prettier-java/", | ||
organizationName: "jtkiesel", | ||
projectName: "prettier-java", | ||
onBrokenLinks: "throw", | ||
onBrokenMarkdownLinks: "warn", | ||
i18n: { | ||
defaultLocale: "en", | ||
locales: ["en"] | ||
}, | ||
presets: [ | ||
[ | ||
"classic", | ||
{ | ||
docs: { | ||
sidebarPath: "./sidebars.ts", | ||
editUrl: | ||
"https://github.com/jtkiesel/prettier-java/tree/docs/create-website/website/" | ||
}, | ||
blog: { | ||
showReadingTime: true, | ||
editUrl: | ||
"https://github.com/jtkiesel/prettier-java/tree/docs/create-website/website/" | ||
}, | ||
theme: { | ||
customCss: "./src/css/custom.css" | ||
} | ||
} satisfies Preset.Options | ||
] | ||
], | ||
themeConfig: { | ||
colorMode: { | ||
respectPrefersColorScheme: true | ||
}, | ||
image: "img/banner-dark.png", | ||
navbar: { | ||
title: "Prettier Java", | ||
logo: { | ||
alt: "Prettier Java Logo", | ||
src: "img/icon.svg", | ||
srcDark: "img/icon-dark.svg" | ||
}, | ||
items: [ | ||
{ | ||
to: "/playground", | ||
label: "Playground", | ||
position: "left" | ||
}, | ||
{ | ||
type: "docSidebar", | ||
sidebarId: "docSidebar", | ||
position: "left", | ||
label: "Docs" | ||
}, | ||
{ to: "/blog", label: "Blog", position: "left" }, | ||
{ | ||
to: "https://github.com/jhipster/prettier-java", | ||
label: "GitHub", | ||
position: "right" | ||
} | ||
] | ||
}, | ||
footer: { | ||
style: "dark", | ||
links: [ | ||
{ | ||
title: "Docs", | ||
items: [ | ||
{ | ||
label: "Introduction", | ||
to: "/docs/introduction" | ||
}, | ||
{ | ||
label: "Installation", | ||
to: "/docs/installation" | ||
} | ||
] | ||
}, | ||
{ | ||
title: "Community", | ||
items: [ | ||
{ | ||
label: "@JHipster on Twitter", | ||
to: "https://twitter.com/jhipster" | ||
} | ||
] | ||
}, | ||
{ | ||
title: "More", | ||
items: [ | ||
{ | ||
label: "Blog", | ||
to: "/blog" | ||
}, | ||
{ | ||
label: "GitHub", | ||
to: "https://github.com/jhipster/prettier-java" | ||
}, | ||
{ | ||
label: "Issues", | ||
to: "https://github.com/jhipster/prettier-java/issues" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
prism: { | ||
theme: prismThemes.github, | ||
darkTheme: prismThemes.dracula | ||
} | ||
} satisfies Preset.ThemeConfig | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.